Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127896 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 8970E1A00BC for ; Fri, 4 Jul 2025 23:27:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1751671528; bh=ZofbtG82zcl1P202qIsY78jiX7ZlHQRtoMTlM5/wcTc=; h=From:Subject:Date:References:To:In-Reply-To:From; b=R3a2CkTb7Iite+UU3cgpZzdIoGsXCzrpIaRXiymIJsQ/0ATIrkDlD/OyLF1UiSGAh hQ5ZnYj7+xloHdTTZEl+0AU8oom1/YflNyQPM39IOnX20I0KOpKsSlCueSO01wsXHY IqQ6T+EPD+Lt88pAz5oQxNsTT8iSDv2avsGbt83aYelN79/q2XRPfFRW6DaAEWShxZ Cdp6sBT7s7bVIcLyYdmeb3FEyHlShC9roBmacU5+fQJewjttwm3uR02KvH3SNvJ3ro xe51ulSayRDvi/5AKUO7waN/HwqZYuzWZWArujMIb7tBfREWl+UlADZBKR8UYQUuTZ KmFt6J2Cv1khw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 892DA18067B for ; Fri, 4 Jul 2025 23:25:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: * X-Spam-Status: No, score=1.7 required=5.0 tests=BAYES_50,DMARC_NONE, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 4 Jul 2025 23:25:27 +0000 (UTC) Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-7086dcab64bso11454527b3.1 for ; Fri, 04 Jul 2025 16:27:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751671638; x=1752276438; h=message-id:in-reply-to:to:references:date:subject:mime-version:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WEaK5tDacw9RsfWQU1kv8WpU/Dcq/pI4hW7kK0Ztbeg=; b=Mgslwzqu2ymRi/XhlMjiMK/qJCo97ni151t0nnJsp4g0eC9c24tAL+1p+ce1k06GBY I7lfz7tsdQbNGB87JlldyN068zrmOTCblAZnwd3xdgW5NgrvOWx0gXIy104T4Fbuqr3v yXQ/GPf8qtKeW2+C+Z6S/u7ReYSxzAuc3heHHcyId15yfu182J464PXRq73bJvYuKWsM UwZ5E6qcy5zbFec5AASQ/eaKybjT1lSQxAB5waIaOUiFDFzmRI1lvXQDt4JhIR+OSMV7 LyPVYzNWCRDllKheaCkAZ2j13P70JnK50TCIvLcZmONZ+e/n68Ag+ARclv/ymm0+0on9 0qqw== X-Gm-Message-State: AOJu0YwO+GcZ/fePm2ATx+xFtwl2i4PYOZSp9yAHG0G/nBRb4P5a0Prn QVWyKrgPPoJydc6cCRTeNceLDoed5QZfIM4BbLJ/l0wlBHXaM6485e3epJr4OqnJxs3RQCzCMlm uZXQ0l+P2 X-Gm-Gg: ASbGncsZUWxXmZXZRozVoKAdlO5+ALZYIyp3WEK3NeiTtxp2l4cCEbT9HH/Z6Rz9vxN 0vUZvz8A5/Q4Yyr77fdAGnfVv6RFxufqm0pqOGLqbVdx9oZm+tybYWNvKEjwHk14KhBpfRjJ0Qx ysKH35ZHlvILXrdPf2x6OWsl1i1Oheqt2TBNvMFYJKKCAopS7N9kPQCNk+7K0uxI7fEEceWK6cj fk9+QDMLTV3qpaRwLB7GiNa7QS0eF04A84LxOsL1+FjyzRhQcX9GNJF9LMs0h6cypwluQNqOr23 4kLWY0idsl2EPPeeEZBfR+VjBFJvPwfBRcJSIfx/Xah6rRPTzFp4rAXVUPK3tRS7iQUQpHbOUnC 5ZxmxyvEN2QXb/9w/g3RZ8iEZuYM45TdBh7+bqCseI5fEeUzqUA== X-Google-Smtp-Source: AGHT+IGnQS44qnhLh0B8ew4OHiLvMyNiktmyrE6JbmQI/vJklxEGZT3a+UKk5dOPJP4KO/TyFCD6dw== X-Received: by 2002:a05:690c:84:b0:714:13:357a with SMTP id 00721157ae682-7166b66fbe9mr53813637b3.20.1751671638271; Fri, 04 Jul 2025 16:27:18 -0700 (PDT) Received: from smtpclient.apple (h96-61-170-179.lvrgtn.broadband.dynamic.tds.net. [96.61.170.179]) by smtp.gmail.com with ESMTPSA id 00721157ae682-71665b46086sm6018357b3.108.2025.07.04.16.27.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Jul 2025 16:27:17 -0700 (PDT) Content-Type: multipart/signed; boundary="Apple-Mail=_AED0A293-C600-4C69-A1A5-71FD7BCE0C13"; protocol="application/pgp-signature"; micalg=pgp-sha256 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.600.51.1.1\)) Subject: Re: [PHP-DEV] [RFC] JSON Schema validation support Date: Fri, 4 Jul 2025 18:27:06 -0500 References: <9B2997E3-21C9-47D9-BB54-99C83A481ED8@php.net> To: PHP internals list In-Reply-To: <9B2997E3-21C9-47D9-BB54-99C83A481ED8@php.net> Message-ID: <0BE9291A-A044-4660-AF80-AABE7C4B820A@php.net> X-Mailer: Apple Mail (2.3826.600.51.1.1) From: ramsey@php.net (Ben Ramsey) --Apple-Mail=_AED0A293-C600-4C69-A1A5-71FD7BCE0C13 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jul 4, 2025, at 18:07, Ben Ramsey wrote: >=20 >> On Jul 4, 2025, at 16:01, Jakub Zelenka wrote: >>=20 >> Hello, >>=20 >> I would like introduce and open discussion for RFC proposing the = addition of JSON Schema validation support to JSON extension: >>=20 >> https://wiki.php.net/rfc/json_schema_validation >>=20 >> If this is successful, it should be just the first for further = improvements (see the future scope). >>=20 >> Kind regards, >>=20 >> Jakub >=20 >=20 > There are 9 versions of JSON Schema and 11 Internet-Drafts, all of = which have expired. Many of these versions are still widely used in the = wild (draft-04, draft-05, and draft-06 come to mind as heavily used, = despite several newer versions). >=20 > Which version do you plan to target with this RFC, or will it be able = to parse all versions, depending on what the input has specified in the = `$schema` properties? I=E2=80=99ve even seen multiple schema versions = used within the same set of referenced documents, and as long as the = parser knows how to handle all versions, it will parse things just fine. >=20 > For the reference of others on the list, here=E2=80=99s what I mean by = 9 versions and 11 I-Ds: >=20 > * Version: 2020-12 > - https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-01 > - https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00 >=20 > * Version: 2019-09 > - https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-02 >=20 > * Version: draft-07 > - https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-01 > - https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-00 >=20 > * Version: draft-06 > - https://datatracker.ietf.org/doc/html/draft-wright-json-schema-01 >=20 > * Version: draft-05 > - https://datatracker.ietf.org/doc/html/draft-wright-json-schema-00 >=20 > * Version: draft-04 > - https://datatracker.ietf.org/doc/html/draft-zyp-json-schema-04 >=20 > * Version: draft-03 > - https://datatracker.ietf.org/doc/html/draft-zyp-json-schema-03 >=20 > * Version: draft-02 > - https://datatracker.ietf.org/doc/html/draft-zyp-json-schema-02 >=20 > * Version: draft-01 > - https://datatracker.ietf.org/doc/html/draft-zyp-json-schema-01 >=20 > Typically, when you create a JSON Schema document, you specify the = `$schema` property, the value of which is a URI that refers to the = schema version you=E2=80=99re using, like this: >=20 > ``` > { > "$schema": "https://json-schema.org/draft/2020-12/schema" > } > ``` >=20 > This lets the parser know what =E2=80=9Cflavor=E2=80=9D of JSON Schema = you=E2=80=99re using. The problem is that many parsers don=E2=80=99t = understand all schema versions, and the most popular one in PHP = (justinrainbow/json-schema = ) only = supports draft-03 and draft-04, both well over 12 years old, at this = point. >=20 > Perhaps the JSON Schema library that is most robust and supports the = latest versions is the opis/json-schema package = . It supports draft-06, draft-07, = 2019-09, and 2020-12, which is pretty much all the newer ones that = justinrainbow/json-schema doesn=E2=80=99t support. >=20 > I think your RFC needs to address all these versions and how you plan = to address compatibility issues between them all. >=20 > Since all the I-Ds have expired without a formal IETF RFC being voted = on and passing, you should probably call attention to the fact that JSON = Schema, while not moving much right now, is still a moving target and = any new versions will require updates to the core to support them. >=20 > Cheers, > Ben Another thing that needs to be addressed in the RFC is how error = reporting will work. I see this hinted at under Future Scope, but one of = the benefits of the existing JSON Schema Composer packages is the robust = level of error reporting they provide. I think robust error reporting is base-level functionality and = non-optional for a minimum viable feature. I won=E2=80=99t have a reason = to use the built-in JSON Schema functionality until it has a certain = level of error reporting that goes well beyond simple = `JSON_ERROR_SCHEMA_*` error codes. I see that the JSO C library supports JSON Schema validation for = draft-04 and draft-06. IMO, you will need at least 2020-12 support, = since this is the version that OpenAPI 3 has adopted, and any tooling = for it will require support for parsing 2020-12 schemas. Cheers, Ben --Apple-Mail=_AED0A293-C600-4C69-A1A5-71FD7BCE0C13 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iHUEAREIAB0WIQToXQMR3fpbrPOmEOewLZeYnIwHGwUCaGhjSgAKCRCwLZeYnIwH G++2AP9U74ouO2gPDerm6WX04yo2GRjhAt3V1kY96BjQBBgoYAD/ebQiaw9HfaeA 5h2aqmoknYimOqODR50Fz6Po+dFY148= =Ua3h -----END PGP SIGNATURE----- --Apple-Mail=_AED0A293-C600-4C69-A1A5-71FD7BCE0C13--