Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127898 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 3423B1A00BC for ; Fri, 4 Jul 2025 23:41:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1751672388; bh=E4VzvX4bhLJLQYpsbX+JHHralnEEQ7YI29k8ph4DM88=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=QAVfHR7jtHwx3rb1hbGtd/zPzfvUXTPmLn8Oo9Vojkxpf8AYWVR+HO6xRO/QRl7JJ v01ENE3kz7Q2CpBWgJITAYbQqn/s4cGlNJ0rVTdTjqzpz5FTOZRzLqdF9sR64/ov0L 4Ncyh26UwL2o2z7IADBNBOzsRO2nRQP3yabsw6EiTSsSiD6gwQbx23mHh69X1qsTI6 wHXnS5ksFEdrd+Kv9Nx3rrBzw6TwXlZUpJsaM1ocOZXBCk1fwPQ09tVaIhYOyKbNPz kmdYPBqyFi/XExlJwvp9N0BGiG8HJTha2dG5cGq6xCgjqIBHOxRfunib7L2GDHBE2H Wwul5s8J4UU3A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 43831180088 for ; Fri, 4 Jul 2025 23:39:47 +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=3.7 required=5.0 tests=BAYES_50,DMARC_NONE, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, 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-oo1-f50.google.com (mail-oo1-f50.google.com [209.85.161.50]) (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:39:46 +0000 (UTC) Received: by mail-oo1-f50.google.com with SMTP id 006d021491bc7-60f24b478e3so793157eaf.3 for ; Fri, 04 Jul 2025 16:41:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751672498; x=1752277298; 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=E4VzvX4bhLJLQYpsbX+JHHralnEEQ7YI29k8ph4DM88=; b=sYjohWBWd9VLssnr483DjOu2rUwooeDewPcxISvZ75vazGe+bUS76pnfnwysfqkQfx 5RdO9yCNL01K7vUP68+Yo0MlhCWu94lcshesz26zUngC+ZglADpjaedl/mQOItaBUeWm nf/IWqwX/eG+bflUDWxNQeAj2W/7JXOmR0LOdtJ3yNi7IzfmlkXIA83N84pISdceh4eH kp36N+fPwuaAdvjIxAOTfKt7onKcl5nBLV4bs4OqHel7s7miLuOiVhRK0tin0TqnSZR0 gCNN61QbLSchqNdOV55VGi/mOxIFK1ZtL7PtryAHvwdavXepynKgT/n/OC5n0myVy3I2 ZbAA== X-Gm-Message-State: AOJu0YzdpzAECph24RLx5GDTNu/Blvt2m+LcVCTfSxhsg3CSj2p/BqXp iozZycNEz0NySZXDmyVG0kSezNcuT9O1HzKrkTudhhqI6GTCzSAADJYQb2AFHKRmUPbmzx3/p0N RnIh+ALe+Swq6rtaBbW/u0iSHYiM3EbylOA== X-Gm-Gg: ASbGncshRc73DITyUzf56hN6abETdK33KRiCwPM3cG3YXb+sLpmYhP08Y4oXpifWPkm 4XcjiRa07RFpmTudw7opBzxkHS6slMj22XE/+otWi0/NYrCK5E1cj2krEgIAb7feXegCgLbB9e6 DxOZIsUvhYE/uHIE1MMrJH9ccRXfCF/kUoR3N4cvaX5HQxYFUGO3My9w== X-Google-Smtp-Source: AGHT+IFA+Hism5ln+RsVBJ6peVV3DLojqr35m3wcI4Uqy8/K6ldUq0Uv/y8at8WnKZJxahUAsFEOU2p4jBZhahen4g8= X-Received: by 2002:a05:6808:4f4a:b0:40b:230d:5ae4 with SMTP id 5614622812f47-40d073f07b3mr2417767b6e.36.1751672498141; Fri, 04 Jul 2025 16:41:38 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <9B2997E3-21C9-47D9-BB54-99C83A481ED8@php.net> <0BE9291A-A044-4660-AF80-AABE7C4B820A@php.net> In-Reply-To: <0BE9291A-A044-4660-AF80-AABE7C4B820A@php.net> Date: Sat, 5 Jul 2025 01:41:27 +0200 X-Gm-Features: Ac12FXwaUir_T5KDy5-bhUH8XqI3FMzXjCoUKG5Vpvl81WuixmRD1SkHoNzPfWE Message-ID: Subject: Re: [PHP-DEV] [RFC] JSON Schema validation support To: Ben Ramsey Cc: PHP internals list Content-Type: multipart/alternative; boundary="00000000000003bf2e06392309e9" From: bukka@php.net (Jakub Zelenka) --00000000000003bf2e06392309e9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Jul 5, 2025 at 1:29=E2=80=AFAM Ben Ramsey wrote: > Another thing that needs to be addressed in the RFC is how error reportin= g > will work. I see this hinted at under Future Scope, but one of the benefi= ts > of the existing JSON Schema Composer packages is the robust level of erro= r > reporting they provide. > > The error reporting is done using normal error codes and exceptions get some sort of identification message. It doesn't collect multiple errors with exact pointers to the place in the same way as the current JSON parser doesn't do that - this is just how things are in the JSON extension and this doesn't try to address all problems in one go - it basically needs some extra parser context for this which is not there yet. > 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. > > Well you don't have to use it from the start. The reason for introduction in this form is to mainly get something that we can build on. It is also important to know that it makes sense to spend more time on it. It already required lots of time to implement. If we used the same standard on the json parser, we would never have json extension in PHP because the error reporting does not provide complete info= . > 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 requi= re > support for parsing 2020-12 schemas. > None of the implementations started with support for all drafts from the start. We will eventually support all but I don't see why that would have to be done from the beginning. Kind regards, Jakub --00000000000003bf2e06392309e9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sat, Jul 5, 2025 at 1:29=E2=80=AFAM Be= n Ramsey <ramsey@php.net> wrote= :
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.


The error reporting is done using norm= al error codes and exceptions get some sort of identification message. It d= oesn't collect multiple errors with exact pointers to the place in the = same way as the current JSON parser doesn't do that - this is just how = things are in the JSON extension and this doesn't try to address all pr= oblems in one go - it basically needs some extra parser context for this wh= ich is not there yet.
=C2=A0
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 bui= lt-in JSON Schema functionality until it has a certain level of error repor= ting that goes well beyond simple `JSON_ERROR_SCHEMA_*` error codes.


Well you don't have to use it from= the start. The reason for introduction in this form is to mainly get somet= hing that we can build on. It is also important to know that it makes sense= to spend more time on it. It already required lots of time to implement.

If we used the same standard on the json parser, we= would never have json extension in PHP because the error reporting does no= t provide complete info.
=C2=A0
I see that the JSO C library supports JSON Schema validation for draft-04 a= nd 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 su= pport for parsing 2020-12 schemas.

None= of the implementations started with support for all drafts from the start.= We will eventually support all but I don't see why that would have to = be done from the beginning.

Kind regards,

Jakub
--00000000000003bf2e06392309e9--