Jakub, wow, great to know this. thanks for writting. Ok, then .... I will assume that this feature will come from you sometime in future.
Since json_validate() was announced ... I have being receiving messages (a lot) about providing the ability to use JSON SCHEMAS as well, hopefully we will have this in PHP in 8.4 (this will be a shock!) Question ... are you planning to incorporate this by enhancing json_validate() ??? El mié, 1 mar 2023 a las 9:07, Jakub Zelenka (<bu...@php.net>) escribió: > > On Wed, Mar 1, 2023 at 11:44 AM juan carlos morales > <dev.juan.mora...@gmail.com> wrote: >> >> Hello Internals. >> >> I am thinking about improving the json_validate() function developed >> for php 8.3. >> >> The actual descriptions goes like this: >> >> json_validate(string $json, int $depth = 512, int $flags = 0): bool >> >> I am thinking about enhancing this function to also be able to >> validate against a JSON SCHEMA, giving us something like this: >> >> json_validate(string $json, int $depth = 512, int $flags = 0, string >> $json_schema = null): bool >> >> so, if the string is a valid JSON and also respects the schema ... then TRUE. >> >> What do you think ? >> > > I'm actually working on this. Currently developing the schema parsing in pure > C implementation in my play C tool called jso. You can see progress here: > https://github.com/bukka/jso/commits/next . The plan is to develop it inside > jso and then port it to jsond and then propose it for json ext inclusion > (that's how I developed the current parser). There is a lot of to do as > JsonSchema is quite complex (composition, JSON pointers, stream integration > for external pointers and more tricky bits) so this won't likely be ready for > 8.3 but should be ready for 8.4. I plan to introduce some smaller things for > 8.3 like better error reporting (error location which I have already working > in jso) and some other small additions. By the way, the schema support won't > be useful just for validation but also for decoding and possibly encoding > (sort of replacement for JsonSerializable). Especially for decoding it can be > further extended to allow class mapping. We could also provide automatic > generation of schema from class and support attributes. I plan to propose all > of this later as well but that might take some time. > > Regards > > Jakub -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php