Skip to content

Commit d62538f

Browse files
committed
Merge pull request #1 from Acubed/aaa-uri-fix
s/resolution scope/base URI/
2 parents 0ad7320 + f3f6171 commit d62538f

File tree

2 files changed

+34
-41
lines changed

2 files changed

+34
-41
lines changed

jsonschema-core.xml

Lines changed: 32 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@
176176
<section title="JSON Schema primitive types">
177177
<t>
178178
JSON Schema defines seven primitive types for JSON values:
179+
<!-- TODO integer and number are both the same syntax, integer is just a subset -->
179180
<list style="hanging">
180181
<t hangText="array">A JSON array.</t>
181182
<t hangText="boolean">A JSON boolean.</t>
@@ -221,7 +222,7 @@
221222
</t>
222223

223224
<t>
224-
An instance may also be referred to as "JSON instance", or "JSON data".
225+
An instance may also be referred to as a "JSON instance", "JSON data", or "JSON document".
225226
</t>
226227
</section>
227228

@@ -333,6 +334,7 @@
333334

334335
<section title='The "$schema" keyword'>
335336
<section title="Purpose">
337+
<!-- TODO a custom $schema keyword might also be used to enforce minimum required functionality of a validator -->
336338
<t>
337339
The "$schema" keyword is both used as a JSON Schema version identifier and the
338340
location of a resource which is itself a JSON Schema, which describes any schema
@@ -342,9 +344,9 @@
342344
<t>
343345
This keyword SHOULD be located at the root of a JSON Schema. The value of this
344346
keyword MUST be a <xref target="RFC3986">URI</xref> and a valid <xref
345-
target="json-reference">JSON Reference</xref>; this URI MUST be both absolute
346-
and normalized. The resource located at this URI MUST successfully describe
347-
itself. It is RECOMMENDED that schema authors include this keyword in their
347+
target="json-reference">JSON Reference</xref>; this URI MUST be normalized.
348+
The resource identified by this URI MUST successfully describe the current
349+
schema document. It is RECOMMENDED that schema authors include this keyword in their
348350
schemas.
349351
</t>
350352

@@ -375,62 +377,52 @@
375377

376378
</section>
377379

378-
<section title="URI resolution scopes and dereferencing">
380+
<section title="Base URI and dereferencing">
379381
<section title="Definition">
380382
<t>
381383
JSON Schema uses <xref target="json-reference">JSON Reference</xref> as a
382384
mechanism for schema addressing. It extends this specification in two ways:
383385

384386
<list>
385387
<t>JSON Schema offers facilities to alter the base URI against which a
386-
reference must resolve by the means of the "id" keyword;</t>
388+
URI reference must resolve by the means of the "id" keyword;</t>
387389
<t>it offers schemas a mechanism to declare their own URIs, placing no limits on the structure of the URI</t>
388390
</list>
389391

390392
</t>
391393

392394
<t>
393-
Altering the URI within a schema is called defining a new resolution scope.
394-
The initial resolution scope of a schema is the URI of the schema itself, or a suitable substitute URI if none is known.
395+
<!-- TODO: RFC3986 defines exactly how to do this -->
396+
The initial base URI of a schema is the URI of the schema itself, or a suitable substitute URI if none is known.
395397
</t>
396398
</section>
397399

398-
<section title='URI resolution scope alteration with the "id" keyword'>
399-
400+
<section title='Base URI alteration with the "id" keyword'>
400401
<section title="Valid values">
401402
<t>
402-
The value for this keyword MUST be a string, and MUST be a valid URI (relative or absolute).
403+
The value for this keyword MUST be a string, and MUST be a valid URI-reference [RFC3986].
403404
This URI SHOULD be normalized, and SHOULD NOT be an empty fragment (#) or the empty string.
404405
</t>
405406
</section>
406407

407408
<section title="Usage">
408409
<t>
409-
The "id" keyword is used to alter the resolution scope.
410-
When an id is encountered, an implementation MUST resolve this id against
411-
the most immediate parent scope. The resolved URI will be the new resolution
412-
scope for this subschema and all its children, until another "id" is
413-
encountered.
410+
The "id" keyword defines the URI of the schema and the base URI that other URI references within
411+
the schema are resolved against. The "id" keyword itself is resolved against a base URI as
412+
specified in [RFC3986].
414413
</t>
415-
416414
<t>
417-
When using "id" to alter resolution scopes, schema authors SHOULD ensure
418-
that resolution scopes are unique within the schema.
415+
The outermost schema of a JSON Schema document SHOULD be an absolute-URI (containing a scheme, but no fragment)
416+
or an absolute-URI with an empty fragment.
419417
</t>
420-
421418
<t>
422-
This schema will be taken as an example:
419+
For example:
423420
</t>
424-
425-
<!--
426-
FIXME: http again as a scheme, maybe another one? It can be any scheme after
427-
all
428-
-->
429421
<figure>
430422
<artwork>
431423
<![CDATA[
432424
{
433-
"id": "http://x.y.z/rootschema.json#",
425+
"id": "http://example.com/rootschema.json#",
434426
"schema1": {
435427
"id": "#foo"
436428
},
@@ -444,7 +436,7 @@
444436
}
445437
},
446438
"schema3": {
447-
"id": "some://where.else/completely#"
439+
"id": "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f"
448440
}
449441
}
450442
]]>
@@ -454,15 +446,15 @@
454446
<t>
455447
Subschemas at the following URI-encoded <xref target="json-pointer">JSON
456448
Pointer</xref>s (starting from the root schema) define the following
457-
resolution scopes:
458-
449+
base URIs:
450+
459451
<list style="hanging">
460-
<t hangText="# (document root)">http://x.y.z/rootschema.json#</t>
461-
<t hangText="#/schema1">http://x.y.z/rootschema.json#foo</t>
462-
<t hangText="#/schema2">http://x.y.z/otherschema.json#</t>
463-
<t hangText="#/schema2/nested">http://x.y.z/otherschema.json#bar</t>
464-
<t hangText="#/schema2/alsonested">http://x.y.z/t/inner.json#a</t>
465-
<t hangText="#/schema3">some://where.else/completely#</t>
452+
<t hangText="# (document root)">http://example.com/rootschema.json#</t>
453+
<t hangText="#/schema1">http://example.com/rootschema.json#foo</t>
454+
<t hangText="#/schema2">http://example.com/otherschema.json#</t>
455+
<t hangText="#/schema2/nested">http://example.com/otherschema.json#bar</t>
456+
<t hangText="#/schema2/alsonested">http://example.com/t/inner.json#a</t>
457+
<t hangText="#/schema3">urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f</t>
466458
</list>
467459
</t>
468460

@@ -504,15 +496,15 @@
504496

505497
<t>
506498
When an implementation encounters the "schema1" reference, it resolves it
507-
against the most immediate parent scope, leading to URI
499+
against the current base URI, leading to URI
508500
"http://my.site/schema1#". The way to process this URI will differ
509501
according to the chosen dereferencing mode:
510502

511503
<list>
512504
<t>if canonical dereferencing is used, the implementation will
513505
dereference this URI, and fetch the content at this URI;</t>
514506
<t>if inline dereferencing is used, the implementation MAY notice that
515-
URI scope "http://my.site/schema1#" is already defined within the
507+
the base URI "http://my.site/schema1#" is already defined within the
516508
schema, and choose to use the appropriate subschema.</t>
517509
</list>
518510
</t>
@@ -521,7 +513,7 @@
521513

522514
<section title="Inline dereferencing and fragments">
523515
<t>
524-
When using inline dereferencing, a resolution scope may lead to a URI which
516+
When using inline dereferencing, a base URI may lead to a URI which
525517
has a non-empty fragment part which is not a JSON Pointer, as in this
526518
example:
527519
</t>
@@ -576,6 +568,7 @@
576568
</t>
577569

578570
<section title='Correlation by means of the "Link" header'>
571+
<!-- HTTP linking is referenced by specs that have nothing to do with HTTP, so this isn't always the case -->
579572
<t>
580573
It is RECOMMENDED that instances be associated with JSON Schemas using the link relation "describedby", as defined by <xref target="RFC5988">RFC 5988, section 5.3</xref>.
581574
</t>

jsonschema-hyperschema.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@
386386
<section title="pathStart">
387387
<t>
388388
This property is a URI that defines what the instance's URI MUST start with in order to validate.
389-
The value of the "pathStart" property MUST be resolved relative to the closest URI Resolution Scope (as defined in the <xref target="json-schema-core">JSON Schema core specification</xref>), using the rules from <xref target="RFC3986">RFC 3986, Sec 5</xref>.
389+
The value of the "pathStart" property MUST be resolved relative to the current URI base (as defined in the <xref target="json-schema-core">JSON Schema core specification</xref>), using the rules from <xref target="RFC3986">RFC 3986, Sec 5</xref>.
390390
</t>
391391

392392
<t>
@@ -416,7 +416,7 @@
416416
<section title="href" anchor="href">
417417
<t>
418418
The value of the "href" link description property is a template used to determine the target URI of the related resource.
419-
The value of the instance property SHOULD be resolved as a URI-Reference per <xref target="RFC3986">RFC 3986</xref> and MAY be a relative reference to a URI.
419+
The value of the instance property SHOULD be resolved as a URI-Reference per <xref target="RFC3986">RFC 3986</xref> and MAY be a URI reference.
420420
The base URI to be used for relative URI resolution SHOULD be the URI used to retrieve the instance object (not the schema).
421421
</t>
422422

0 commit comments

Comments
 (0)