Skip to content

Commit 9e8bf38

Browse files
committed
tweaks for both scope types
1 parent d5914b2 commit 9e8bf38

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

specs/jsonschema-core.md

+14-12
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,9 @@ This specification defines two such scopes: lexical and dynamic.
458458
#### Lexical Scope
459459

460460
The lexical scope of a keyword is determined by the nested JSON data structure
461-
of objects and arrays. The largest such scope is an entire schema document. The
462-
smallest scope is a single schema object with no subschemas.
461+
of objects and arrays. The smallest such scope is a single schema object with no
462+
subschemas. The largest scope is an entire schema document, recursively
463+
including all of its subschemas.
463464

464465
Keywords MAY be defined with a partial value which must be resolved against
465466
another value found within the lexical structure of the JSON document. The
@@ -476,20 +477,21 @@ root object.
476477

477478
#### Dynamic Scope
478479

479-
Other keywords may take into account the dynamic scope that exists during the
480-
evaluation of a schema, typically together with an instance document. The
481-
outermost dynamic scope is the schema object at which processing begins, even if
482-
it is not a schema resource root. The path from this root schema to any
483-
particular keyword (that includes any `$ref` and `$dynamicRef` keywords that may
484-
have been resolved) is considered the keyword's "evaluation path."
480+
The dynamic scope is the ordered collection of schema objects navigated during
481+
evaluation, starting at the root and ending at the subschema under evaluation.
482+
The outermost dynamic scope is the schema object at which processing begins,
483+
even if it is not a schema resource root. The path that evaluation takes,
484+
starting from this root schema to any particular subschema (including any `$ref`
485+
and `$dynamicRef` keywords that may have been resolved), is considered the
486+
"evaluation path".
485487

486488
Lexical and dynamic scopes align until a reference keyword is encountered. While
487489
following the reference keyword moves processing from one lexical scope into a
488490
different one, from the perspective of dynamic scope, following a reference is
489491
no different from descending into a subschema present as a value. A keyword on
490492
the far side of that reference that resolves information through the dynamic
491493
scope will consider the originating side of the reference to be their dynamic
492-
parent, rather than examining the local lexically enclosing parent.
494+
parent rather than examining the local lexically enclosing parent.
493495

494496
The concept of dynamic scope is primarily used with `$dynamicRef` and
495497
`$dynamicAnchor`, and should be considered an advanced feature and used with
@@ -929,9 +931,9 @@ to establish a base IRI in order to resolve the reference.
929931
#### The `$id` Keyword {#id-keyword}
930932

931933
An `$id` keyword in a schema or subschema identifies that schema or subschema as
932-
a distinct schema resource and defines a new lexical scope. The value for this
933-
keyword MUST be a string, and MUST represent a valid IRI reference without a
934-
fragment.
934+
a distinct schema resource and applies to the entire lexical scope of that
935+
schema resource. The value for this keyword MUST be a string, and MUST represent
936+
a valid IRI reference without a fragment.
935937

936938
When the value of this keyword is resolved against the current base IRI, the
937939
resulting absolute IRI then serves as the identifier for the schema resource and

0 commit comments

Comments
 (0)