Skip to content

Commit 7dffce6

Browse files
committed
Even more minor wording adjustment.
1 parent a0df3a4 commit 7dffce6

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
This document describes a simple [JSON Schema vocabulary](https://json-schema.org/draft/2020-12/json-schema-core.html#name-schema-vocabularies) that can be used to validate JSON text sequences as specified by [RFC 7464](https://datatracker.ietf.org/doc/html/rfc7464).
66

7-
It defines two keywords which allow applying a JSON schema to individual elements in a JSON text sequence (hereafter "sequence").
7+
It defines two keywords which allow applying a JSON schema to individual elements in a JSON text sequence (hereafter "sequence") and producing an annotation of the element-wise result of application of the schema.
88

99
Though indeed the entirety of a sequence is not itself a standard JSON type (nor valid JSON), proscribed below is a loose [`stream` type](#streams) whose implementation is left mostly to the specific language or implementation to further define.
1010

@@ -19,13 +19,13 @@ The `$id` for the meta-schema is `https://python-jsonschema.github.io/vocab-json
1919

2020
### 3.1 Syntax and Semantics
2121

22-
The value of the `jsonseq` keyword MUST be a valid JSON Schema.
22+
The `jsonseq` keyword is a JSON Schema [annotation](https://json-schema.org/draft/2020-12/json-schema-core.html#name-annotations) whose value MUST be a valid JSON Schema.
2323

24-
This schema, when applied to a sequence, MUST be evaluated against each sequence element.
25-
The result of this evaluation is an annotation which itself is a stream.
26-
The elements of this annotation MUST be the corresponding validation result for each element in the sequence.
24+
Applying the keyword to a stream instance MUST produce a single annotation result, itself a new stream.
25+
The contents of the annotation stream MUST be the corresponding result of applying the schema element-wise to each element of the sequence.
2726

28-
Validating a non-stream instance against this keyword always succeeds.
27+
Validating an empty stream against this keyword (one which contains no elements) produces an empty stream annotation, as does validating a non-stream instance.
28+
(As discussed [below](#
2929

3030
### 3.2 Contextual Behavior
3131

@@ -45,10 +45,16 @@ The processing of the `jsonseq` keyword, or truthfully of JSON Text Sequences th
4545

4646
This document does not define the specific implementation of streams. A programming language or implementation with lazy iterable support SHOULD represent streams using this language feature.
4747

48-
The core JSON vocabulary [does not allow](https://json-schema.org/draft/2020-12/json-schema-core.html#name-instance-data-model) external vocabularies to define additional types via the `type` keyword.
48+
Implementations MUST also consider JSON `array` values to be streams for the purpose of the keywords defined in this vocabulary.
49+
50+
Schema authors who do not wish to allow `array` valued instances are RECOMMENDED to use existing JSON Schema mechanisms to exclude them (e.g. `{"not": {"type": "array"}}`).
51+
52+
The core JSON vocabulary [does not allow](https://json-schema.org/draft/2020-12/json-schema-core.html#name-instance-data-model) external vocabularies to define additional data types via the `type` keyword.
4953
It does however [allow](https://json-schema.org/draft/2020-12/json-schema-core.html#name-non-json-instances) for the application of JSON Schema to types beyond those provided by JSON.
5054
A `streamType` keyword is therefore introduced below, which can be used to assert a value is a stream in the sense defined here.
5155

56+
(Editor's note: the definition of `streamType` may be moved to a separate vocabulary in the future).
57+
5258
### 4.2 The `streamType` Keyword
5359

5460
The value of the `streamType` keyword MUST be a boolean, or the value `null`.
@@ -57,12 +63,6 @@ When `true`, validation MUST succeed if the instance is a stream, and fail other
5763
When `false`, validation MUST fail if the instance is a stream, and succeed otherwise.
5864
When `null`, validation always succeeds.
5965

60-
Implementations MUST also consider JSON `array` values to be streams for the purpose of the keywords defined in this vocabulary.
61-
62-
Schema authors who do not wish to allow `array` valued instances are RECOMMENDED to use existing JSON Schema mechanisms to exclude them (e.g. `{"not": {"type": "array"}}`).
63-
64-
(Editor's note: the definition of `streamType` may be moved to a separate vocabulary in the future).
65-
6666
## 5. A Short Example
6767

6868
Consider the following schema, utilizing the two keywords above, which asserts that elements of a sequence are objects whose `foo` property is an integer at most 10:

0 commit comments

Comments
 (0)