Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119635 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 93274 invoked from network); 1 Mar 2023 12:45:22 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 1 Mar 2023 12:45:22 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C4CEC180549 for ; Wed, 1 Mar 2023 04:45:21 -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,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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-oa1-f54.google.com (mail-oa1-f54.google.com [209.85.160.54]) (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:45:21 -0800 (PST) Received: by mail-oa1-f54.google.com with SMTP id 586e51a60fabf-1722c48a773so14267304fac.2 for ; Wed, 01 Mar 2023 04:45:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1677674720; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=7Lh2hThqBlu6GjCVOz5WjuU46InyE7ZDw8QSQpS9zUY=; b=OMfXGgEUi5ToI+e6eVc+iWlBQp71FLYuqVnyVoxuzGf6c/62DSGsdzPaKKt3cVpnmG jZDUsWKRENcjmqWcOg05Z+my78NRcLqcqnSW0cG8H3JdkcKIuFi5pisHYavkH4AR+zhM l7j4IuHUf4hPQCqIoQ4zZtBoCL34gszaYrLfPgddAjH/nVMrrbV4o3zXj9VbYuBKf/gH P5XI4DZr4uiLsZGc3u6NcmZDLDTFxW2KJyv9Yrh41AA51UlqaFj5UwMF7bOa4/zUBQgy V9fgaPSrY4QXWY01Gg+DaV6A4luSnLYM0tj+YzptlVAg4NuO01h2UZd8c7cTVeAkAXbc Jzcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677674720; h=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=7Lh2hThqBlu6GjCVOz5WjuU46InyE7ZDw8QSQpS9zUY=; b=TutLdPnTJVtxw0Os2rytQL8kNcbpST+BrteHvR0E8pWK4Xvl8BLKhRkGM+8QNvM0Cn lPtKWOFuBoYplFb8eVsFA2q0gCosB6iHNh8Kl/+2I9lsC+jcZRYISggW2KcrnNeblc6K LHWRJzH/UpnRap9Z2uCm2cdlLYplWTroq43fX6fygkhuklTzYePt0S1HGj+fMDb+pZat qbnrln6Dbfcf0wxbLh8L27/rv9nGiZiiZgC1LWjGE8sATWE91QOH+HG9cl2yCexJayB8 LrGlRihAwML0d6DvpgtYg/KrdAIsMThOu6/OjR93/YAJs69CJq9sGHcny6q/0KZx6wlk qe5A== X-Gm-Message-State: AO0yUKVQcL0HdXPcNEKRAyGXvHRCYVbiG9fpbvyuQ1rL+BBQ7TLOSuVe crDPPV9E7DoHgkNaKEqDxzjgQkb4PTU5piuHZWQ= X-Google-Smtp-Source: AK7set+fwSs9096FXsRGWGCq4N6CVd4rNU54An56kFmVuHxA0IrdClHcVow4sAlw1QpOqYRjBsmJxv1CQK3bnMkVBb4= X-Received: by 2002:a05:6870:772a:b0:176:27af:1c23 with SMTP id dw42-20020a056870772a00b0017627af1c23mr470696oab.7.1677674720406; Wed, 01 Mar 2023 04:45:20 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 1 Mar 2023 09:45:09 -0300 Message-ID: To: juan carlos morales Cc: Jakub Zelenka , PHP Internals List Content-Type: multipart/alternative; boundary="000000000000c231b605f5d61503" Subject: Re: [PHP-DEV] RFC Idea - json_validate() validate schema From: flaviohbatista@gmail.com (=?UTF-8?Q?Fl=C3=A1vio_Heleno?=) --000000000000c231b605f5d61503 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Mar 1, 2023 at 9:23=E2=80=AFAM juan carlos morales < dev.juan.morales@gmail.com> wrote: > 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 () escri= bi=C3=B3: > > > > On Wed, Mar 1, 2023 at 11:44 AM juan carlos morales < > dev.juan.morales@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 =3D 512, int $flags =3D 0): boo= l > >> > >> 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, stri= ng > >> $json_schema =3D null): bool > >> > >> so, if the string is a valid JSON and also respects the schema ... the= n > TRUE. > >> > >> What do you think ? > >> > > > > I'm actually working on this. Currently developing the schema parsing i= n > 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 t= he > 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 suppo= rt > attributes. I plan to propose all of this later as well but that might ta= ke > some time. > > > > Regards > > > > Jakub > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > Great addition folks, looking forward to it! If there is anything that I can do to help, please let me know! --=20 Atenciosamente, Fl=C3=A1vio Heleno --000000000000c231b605f5d61503--