Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8f29265

Browse files
committedFeb 24, 2025
tweaks for both scope types
1 parent c2b342d commit 8f29265

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
@@ -459,8 +459,9 @@ This specification defines two such scopes: lexical and dynamic.
459459
#### Lexical Scope
460460

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

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

478479
#### Dynamic Scope
479480

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

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

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

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

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

0 commit comments

Comments
 (0)
Please sign in to comment.