Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128198 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 C07AC1A00BC for ; Wed, 23 Jul 2025 15:42:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1753285215; bh=kIhyb1FlUVHZmlLqymhuD10xIyh83OAwxn3rGS9Vx7I=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=PA1aSkXG93JBa4J0I/waY7YfjwT5VChaJjLNVyJ1+BXWIK3Ze7lCQVoKWrj283l0R dALuxIHB8k11sQ46gtNTkfRVnV3Hyf3yThDO16J6oZm7oEEJjBwuEYmP4S7Bp/3eYo kw28m9WtiPfxn3mwUEaONl19fAwHrErH4mSilu3T+wolM7ZKmpo9BvtaTYxbRC3k1u UG17rOzedBjiXqKmchI4PYDU26gtT2z8mw/GXIo1jnnuvd3E9KObcdwNsD7xjrk43a 7dZCx6FSNGkbqnmjNGGLG1vJ8szMJQcnw3VxmW6b/BMBtAk/cVNfj2Gm3Zxh7myX6K 8fu5dYfIDZhmg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E670E18054B for ; Wed, 23 Jul 2025 15:40:14 +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=2.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_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-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) (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 ; Wed, 23 Jul 2025 15:40:14 +0000 (UTC) Received: by mail-oi1-f179.google.com with SMTP id 5614622812f47-41eaf97416eso61467b6e.0 for ; Wed, 23 Jul 2025 08:41:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753285319; x=1753890119; 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=kIhyb1FlUVHZmlLqymhuD10xIyh83OAwxn3rGS9Vx7I=; b=rx3z9BwYu+nguHFnoz2naxabYA4ASSQmYEwjGdIKrevjAVltF80FmwfsI0CuaRYcl5 gMMUkhE/t1c5dwvtEX+s8gHxOxU3RlQOjB6puID1lOm7WlOFR+aOCoiUpGE1TLsj537V 1VbjaIhM11SNfp5VUZW2AT6wVnsUXNzkamb/QYRb0N5W/JxPsnoUZNAVNu5GSjN8ROhh PcY4FXEetzGg3dy/nWIPMIb4apkLZIfnmJn9qXhzjCBnqT77mE6tdz7WYrkUPZG1QTWP f0Nh66as9BPNaxtQ7UjIyZdSAOSXmfs3OT+0fOXH4BCxzMVmfgeNZS/DbhLh82vKdsMj yDaw== X-Gm-Message-State: AOJu0Yw9A6tzUSsq5OGaSdNgfIBv4Taxcc83XoaRjLJTJT12WWu2Lhha yYilTWDwdOpGPsiE/wHNoJXuHdJTxqiii3T8FK4h75IITmDWjBCjDyXnLBy+s9UCV9YzcgQUN13 l3zd2VIcunCa7hjvxdZ+siGmn60pOizB6aHg0 X-Gm-Gg: ASbGncu0yJe5OKlhx8chi8bWWuAEtOZ7kTdDq71hR2JDA6TgYg8YjHvcjyJwqFyU2kr 19I++UCWAPSLfYcCkN2Us47sttNVjRv3trak6Efb2eyhm0oiIVhAwZ4Ocd9IVAYk1olNED5rZ/D ewVMXmzeiswC2wYWd56Xr9raXUii6yqGESNJuQ51yGXv7HN1laSh/wx4XnAN+14mGZyBX8Om+rV fwN/TY= X-Google-Smtp-Source: AGHT+IH2LWk3Ebv2XtgVKh/hJb79LyMbARqwUWTE4QoXVnrcup1FvKSn50um/FZUNdKzLbsrUF5LNH8rw02VAjxJCak= X-Received: by 2002:a05:6808:191c:b0:41b:e029:bbbb with SMTP id 5614622812f47-426c6b07928mr2373387b6e.22.1753285318879; Wed, 23 Jul 2025 08:41:58 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 23 Jul 2025 17:41:47 +0200 X-Gm-Features: Ac12FXzI3OjdI-iy6Hifcv58kjrF7ioChugcuuyzLtLbpRpHM4QpeNK6jiE9e3g Message-ID: Subject: Re: [PHP-DEV] [RFC] JSON Schema validation support To: Alexandre Daubois Cc: PHP internals list Content-Type: multipart/alternative; boundary="0000000000009f2cfa063a9a8c3f" From: bukka@php.net (Jakub Zelenka) --0000000000009f2cfa063a9a8c3f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Alex, On Wed, Jul 23, 2025 at 3:57=E2=80=AFPM Alexandre Daubois < alex.daubois+php@gmail.com> wrote: > Thank you for proposing such a feature! I personally really like it > and would be glad to see this land into PHP. > I think it would be even more useful if JsonSchema offers more ways to > load a schema. Schemas are often either remotely stored or stored in a > file. > Yes, this is exactly the reason why it's using a static method and not a constructor It would be great to add two new factory methods: > JsonSchema::fromUri() and JsonSchema::fromFile(). Yeah something like this is planned in the next stage. In addition it could be useful to create it from array or from class (sort of auto generate schema) as well but that's all feature scope. > Maybe > JsonSchema::createFromString() should also be renamed to fromString() > to be consistent with the recent additions to XMLReader. > I actually took that name from recently introduced HTMLDocument::createFromString and XMLDocument::createFromString . So not sure what is more consistent. Personally I don't really mind. Kind regards Jakub --0000000000009f2cfa063a9a8c3f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Alex,

On Wed,= Jul 23, 2025 at 3:57=E2=80=AFPM Alexandre Daubois <alex.daubois+php@gmail.com> wrote:
=
Thank you for proposing such a feature! I personally really like it
and would be glad to see this land into PHP.
I think it would be even more useful if JsonSchema offers more ways to
load a schema. Schemas are often either remotely stored or stored in a
file.

=C2=A0Yes, this is exactly the re= ason why it's using a static method and not a constructor
It would be great to add two new factory methods:
JsonSchema::fromUri() and JsonSchema::fromFile().

Yeah something like this is planned in the next stage. In addition = it could be useful to create it from array or from class (sort of auto gene= rate schema) as well but that's all feature scope.
=C2=A0
Maybe
JsonSchema::createFromString() should also be renamed to fromString()
to be consistent with the recent additions to XMLReader.

=C2=A0I actually took that name from recently introduced= =C2=A0HTMLDocument::createFromString and XMLDocument::createFromString . So= not sure what is more consistent. Personally I don't really mind.

Kind regards

Jakub
--0000000000009f2cfa063a9a8c3f--