Re: RFC Idea - json_validate() validate schema

From: Date: Thu, 02 Mar 2023 19:31:45 +0000
Subject: Re: RFC Idea - json_validate() validate schema
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-119657@lists.php.net to get a copy of this message
On Thu, Mar 2, 2023 at 5:53 PM Rowan Tommins <rowan.collins@gmail.com> wrote: > On Thu, 2 Mar 2023 at 12:34, Jakub Zelenka <bukka@php.net> wrote: > > > It's possible that we might decide to stop supporting some drafts if the > > maintenance burden is too big and usage small but I wouldn't see that as > > something that happens often. But essentially you are right that there > will > > be minimum (draft-04 initially) and maximum (latest implemented draft). > > > > > 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 lists the > supported versions, so that code needing a particular version could check > for support directly, rather than having to attempt and catch an exception? > > 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 think that the $schema should have a priority. So having just default argument using the constant for the cases where it's not specified should be sufficient IMHO. Cheers Jakub

« previous php.internals (#119657) next »