Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119634 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 90821 invoked from network); 1 Mar 2023 12:23:08 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 1 Mar 2023 12:23:08 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8A923180549 for ; Wed, 1 Mar 2023 04:23:07 -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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ua1-f48.google.com (mail-ua1-f48.google.com [209.85.222.48]) (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 ; Wed, 1 Mar 2023 04:23:07 -0800 (PST) Received: by mail-ua1-f48.google.com with SMTP id d12so3522291uak.10 for ; Wed, 01 Mar 2023 04:23:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1677673386; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Vj7YiG9fFwbBUKHiVrSAv4+AQPwgigLv657nfkL/MZg=; b=oP6nkvtX0PuQJbYqyRL5AYENDInLn8Zd0BbuAf9ZqPzOdSNEglAM3djCPSAWAvzHjZ 4niYjGiSzOA7QBJBpF5ww+TMXXHyPuOFPbFL7AbojRgFYZ0XmtqFjxDvIyz4VMV2KPsg 1+f/rim3KcX4p0UlaboVKrR2cc5bbivwnoCSa5/lbc4BNspFgO0SkxIqiFJBa8uvsh8H qoi4MsTvnW7IR4p85N9k2kDJSKYaH3Np7X6n/R9F/0+ex0fTVVtavoZPF+KPIuNeCRAL IIFAnD73b8IFec/2hVrDtr0fwEYwBrmOiUoAfIxnZAarfDTm6J17/m1Z2BDSkDvyi2HM xLCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677673386; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Vj7YiG9fFwbBUKHiVrSAv4+AQPwgigLv657nfkL/MZg=; b=Yt48Ny87NQ8TZE3LoTQd9NjZEt7BW95LXo8ys3hHxUe+r21FsNHo/i8YgRSvehtrc1 ajC06guZpHN3c87w7ByQVJybFDUXbBOmrI0IjW97ONXVp2LZZVNZvZi9qyLvhug7zmeI 1iMS4fD5U1CjfNovTHuZbWYXwMZ5j6EvK0oLojZ66vRA5P3qzpoMuFDm3r+zcdPzkyhM sQ9CRXyrgp571XQ5+lKMbgpTU/WGa3xsIrKzMGQJuAz+Cg9oAZJ+1E01cB9jyTRvZWkG P6bk+F8VyefynGsZ3ETSBRLkCRZ/dlwSngN4/+ReKkodA5Xgb84shOFBYMbCDbzEuEvn L4ew== X-Gm-Message-State: AO0yUKWMg9Z1FI/8jSpmMR9bnCuplcRtDUtkq3a7HJoA5mh2NbpwenLj sYQG2yE26z/N+f86ZMn0fUGiLwka0sebJ6rsqvs= X-Google-Smtp-Source: AK7set+guBJ11xH0YxejmeCiyabdmjA6HrCS7c+HCh9lZbPiaZ1JegOcqSbTSj1rJ07q5bUantWsed2Ec4EiJ26ofWE= X-Received: by 2002:ab0:5b01:0:b0:68b:8b67:8209 with SMTP id u1-20020ab05b01000000b0068b8b678209mr3541915uae.2.1677673386391; Wed, 01 Mar 2023 04:23:06 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 1 Mar 2023 09:22:55 -0300 Message-ID: To: Jakub Zelenka Cc: PHP Internals List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] RFC Idea - json_validate() validate schema From: dev.juan.morales@gmail.com (juan carlos morales) 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=C3=A9, 1 mar 2023 a las 9:07, Jakub Zelenka () escribi= =C3=B3: > > On Wed, Mar 1, 2023 at 11:44 AM juan carlos morales 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 =3D 512, int $flags =3D 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 =3D 512, int $flags =3D 0, string >> $json_schema =3D 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 he= re: https://github.com/bukka/jso/commits/next . The plan is to develop it i= nside jso and then port it to jsond and then propose it for json ext inclus= ion (that's how I developed the current parser). There is a lot of to do as= JsonSchema is quite complex (composition, JSON pointers, stream integratio= n 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 thin= gs 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 sup= port won't be useful just for validation but also for decoding and possibly= encoding (sort of replacement for JsonSerializable). Especially for decodi= ng it can be further extended to allow class mapping. We could also provide= automatic generation of schema from class and support attributes. I plan t= o propose all of this later as well but that might take some time. > > Regards > > Jakub