From 9e81619ed8f518296537b56e3dbabd4b8cd92c83 Mon Sep 17 00:00:00 2001 From: "Henry H. Andrews" Date: Sun, 18 Sep 2022 15:34:51 -0700 Subject: [PATCH 1/4] Explain why plain name fragments are as they are Because XML is/was the most likely need for cross-media-type fragment identifiers. --- jsonschema-core.xml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index 1001eb83..767ab305 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -1458,8 +1458,11 @@ If present, the value of this keyword MUST be a string and MUST start with a letter ([A-Za-z]) or underscore ("_"), followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), and periods ("."). - This matches the US-ASCII part of XML's - NCName production. + Due to the once-common practice of providing resource representations in + both JSON and XML, this matches the US-ASCII part of XML's + NCName production, which is noted in the + WC3's best practices for fragment identifiers + as the typical plain name syntax for XML-based formats. Note that the anchor string does not include the "#" character, as it is not a IRI-reference. An "$anchor": "foo" becomes the From f367d474a9b531978a783a1de22cebf77132ac02 Mon Sep 17 00:00:00 2001 From: "Henry H. Andrews" Date: Thu, 22 Sep 2022 19:36:21 -0700 Subject: [PATCH 2/4] Reorganize plain name fragment requirements In response to PR review feedback, remove the editorial explanation and instead consolidate the fragment syntax in the section on fragments. The context and reason for the syntax is more clear there with the existing text, and one additional line further clarifies it by not just seeming to reference a random XML syntax rule for no clear reason. --- jsonschema-core.xml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index 767ab305..037bcfc7 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -12,6 +12,7 @@ + ]> @@ -513,7 +514,18 @@ Per the W3C's best practices for fragment identifiers, plain name fragment identifiers in "application/schema+json" are reserved for referencing - locally named schemas. All fragment identifiers that do + locally named schemas. + + + Plain name fragments MUST start with a letter ([A-Za-z]) or underscore ("_"), + followed by any number of letters, digits ([0-9]), hyphens ("-"), + underscores ("_"), and periods ("."). This matches the US-ASCII part of XML's + NCName production, which allows for compatibility + with the recommended plain name syntax for + XML-based media types. + + + All fragment identifiers that do not match the JSON Pointer syntax MUST be interpreted as plain name fragment identifiers. @@ -1455,14 +1467,9 @@ need for "$dynamicAnchor". - If present, the value of this keyword MUST be a string and MUST start with - a letter ([A-Za-z]) or underscore ("_"), followed by any number of letters, - digits ([0-9]), hyphens ("-"), underscores ("_"), and periods ("."). - Due to the once-common practice of providing resource representations in - both JSON and XML, this matches the US-ASCII part of XML's - NCName production, which is noted in the - WC3's best practices for fragment identifiers - as the typical plain name syntax for XML-based formats. + If present, the value of this keyword MUST be a string and MUST conform + to the plain name fragment identifier syntax defined in section + . Note that the anchor string does not include the "#" character, as it is not a IRI-reference. An "$anchor": "foo" becomes the @@ -3558,6 +3565,7 @@ https://example.com/schemas/common#/$defs/allOf/1 &RFC7231; &RFC8288; &fragid-best-practices; + &xptr-framework; JSON Schema Validation: A Vocabulary for Structural Validation of JSON From 903240e5a7cf30d58b83c53829a14232dd904562 Mon Sep 17 00:00:00 2001 From: "Henry H. Andrews" Date: Thu, 22 Sep 2022 19:41:14 -0700 Subject: [PATCH 3/4] Fix singular to plural "these keywords" for both "$anchor" and "$dynamicAnchor" --- jsonschema-core.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index 037bcfc7..e5be8bbe 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -1467,7 +1467,7 @@ need for "$dynamicAnchor". - If present, the value of this keyword MUST be a string and MUST conform + If present, the value of these keywords MUST be a string and MUST conform to the plain name fragment identifier syntax defined in section . From c4aed5eab5ba403e607ce32228a54b123525a8d5 Mon Sep 17 00:00:00 2001 From: "Henry H. Andrews" Date: Sun, 2 Oct 2022 13:52:19 -0700 Subject: [PATCH 4/4] Remove stray empty paragraph. --- jsonschema-core.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index e5be8bbe..94392427 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -534,8 +534,6 @@ "application/schema+json" document are specified in the "$anchor" keyword section. - -