Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119660 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 34557 invoked from network); 2 Mar 2023 20:29:58 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 2 Mar 2023 20:29:58 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id F1E3B180511 for ; Thu, 2 Mar 2023 12:29:56 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS29838 64.147.123.0/24 X-Spam-Virus: No X-Envelope-From: Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 2 Mar 2023 12:29:56 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 0854D3200AB4 for ; Thu, 2 Mar 2023 15:29:54 -0500 (EST) Received: from imap50 ([10.202.2.100]) by compute4.internal (MEProxy); Thu, 02 Mar 2023 15:29:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1677788994; x=1677875394; bh=P85+0L16AI 5Z6scqFcv7YzWdfRAjY+pJkHVyaaAUdME=; b=LuxI6Q/Was9d4b1LXU1tyyESvU 1rgA3yl7exjm6/Blj3UJRY2kBR3hAyczmGMp4xhlk52PDNHb9Q5bgB2/05voghAH BvGlY0fStPEHE9zJ4qwlpBM7W6UmWhYJvWKkYiP/mbMRpWIbixGEiAydbRq4xHiy FRTwpqrmMd+mFBC28QZHU0lydGJ89qzwurUiRubQpaoFYGWeKfec0lt/3bFMKqBD Y8JmDu+yJ+kVB89opokjj8kWIuUvF9qoavVo1NyUwntNM3+2DlXdPyb6SKUdbthZ brX0IMq6/SFk8KzG8fwZc0tqR1RdNEfxcz+ZildbtJ+TOUiTUoXxt2XYXLQw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1677788994; x= 1677875394; bh=P85+0L16AI5Z6scqFcv7YzWdfRAjY+pJkHVyaaAUdME=; b=b 5QYgcabaUm7t4EGWTwYpWKGoctkOK1rFn8XVfISC5sp29YK8fRI4Q/b//JN2jyag S2F4/hxCXS3QCP9dd8k80Hp8h4TM1G1xWqeAN2wPrUikdnPp5kakbQt/c+4bTxNG c9gWcAS4c8G73dO24ZEn/YGm4d9sCk3RC8Py1+WI+k4aTMg0LQW3XLPE+IqI24Pk F+O3mKj75ICf3bYqQlOw7Q3an5zKRSjYD47/vCgDx7MYiygsLUr7BMva9b/oncaG DG/yxD5rt7WsURVkdXnV6cMULoggCHbmrGPyQ/6NkMq4UNrR+0iL89zO22zSx8JZ 9x+l6frHkjPn7WMrgz6yQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudeljedgudefhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtgfesthhqredtreerjeenucfhrhhomhepfdfn rghrrhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrd gtohhmqeenucggtffrrghtthgvrhhnpeeggeehgfetjeehgefggefhleeugefgtdejieev vdethfevgeeuudefleehvdetieenucffohhmrghinhepphhhphdrnhgvthenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghr fhhivghlughtvggthhdrtghomh X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 4FD351700089; Thu, 2 Mar 2023 15:29:54 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-183-gbf7d00f500-fm-20230220.001-gbf7d00f5 Mime-Version: 1.0 Message-ID: <7e08b0f9-9d30-4ead-8194-2494ecc78e2e@app.fastmail.com> In-Reply-To: References: Date: Thu, 02 Mar 2023 14:29:33 -0600 To: "php internals" Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] RFC Idea - json_validate() validate schema From: larry@garfieldtech.com ("Larry Garfield") On Thu, Mar 2, 2023, at 1:31 PM, Jakub Zelenka wrote: > On Thu, Mar 2, 2023 at 5:53=E2=80=AFPM Rowan Tommins > wrote: > >> On Thu, 2 Mar 2023 at 12:34, Jakub Zelenka wrote: >> >> > It's possible that we might decide to stop supporting some drafts i= f the >> > maintenance burden is too big and usage small but I wouldn't see th= at as >> > something that happens often. But essentially you are right that th= ere >> will >> > be minimum (draft-04 initially) and maximum (latest implemented dra= ft). >> > >> >> >> Thinking about this, particularly if there is the ability to install = a PECL >> extension which supports different versions from the core PHP version, >> perhaps it would be useful to expose a function or constant that list= s the >> supported versions, so that code needing a particular version could c= heck >> for support directly, rather than having to attempt and catch an exce= ption? >> >> > That's a good point. I think a constant should be sufficient. I think = the > different classes make less sense if $schema is specified as I would t= hink > that the $schema should have a priority. So having just default argume= nt > using the constant for the cases where it's not specified should be > sufficient IMHO. > > Cheers > > Jakub You mean using the version from the JSON string, and allowing an overrid= e? Like this? new JsonSchema($schema_string, version: JsonSchema::DRAFT_4); I see two issues there. 1. If I want to see if DRAFT_6 is available, I have to use defined()[1] = with strings. This is fugly. 2. I don't know how to polyfill newer spec versions if I don't want to w= ait for internals to get around to adding a new version. --Larry Garfield [1] https://www.php.net/manual/en/function.defined