Skip to content

Commit cb1002f

Browse files
committed
$defs to definitions
Signed-off-by: Clemens Vasters <clemens@vasters.com>
1 parent 34d073d commit cb1002f

File tree

1 file changed

+42
-38
lines changed

1 file changed

+42
-38
lines changed

draft-vasters-json-structure-core.md

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ informative:
7373
--- abstract
7474

7575
This document specifies _JSON Structure_, a data structure definition language
76-
that enforces strict typing, modularity, and determinism. _JSON Structure Core_
76+
that enforces strict typing, modularity, and determinism. _JSON Structure_
7777
describes JSON-encoded data such that mapping to and from programming languages
7878
and databases and other data formats is straightforward.
7979

@@ -88,10 +88,11 @@ data to and from programming languages and databases and other data formats
8888
becomes straightforward.
8989

9090
_JSON Structure_ is extensible, allowing additional features to be layered on
91-
top. The core language is a data-definition language. The "validation" and
92-
"conditional composition" extension specification add rules that allow for
93-
complex pattern matching of _JSON Structure_ documents against JSON data for
94-
validation purposes.
91+
top. The core language is a data-definition language.
92+
93+
The "Validation" and "Conditional Composition" extension specifications add
94+
rules that allow for complex pattern matching of _JSON Structure_ documents
95+
against JSON data for document validation purposes.
9596

9697
Complementing _JSON Structure_ are a set of extension specifications that extend
9798
the core schema language with additional, OPTIONAL features:
@@ -138,9 +139,9 @@ This schema constrains a JSON node to be of type `string`:
138139
~~~
139140

140141
In the case of a schema that references a compound type (`object`, `set`,
141-
`array`, `map`), the schema further describes the structure of the compound
142-
type. Such a schema is a "type declaration" as it yields a new type that can be
143-
referenced by other schemas if placed into a namespace ({{namespaces}}).
142+
`array`, `map`, `tuple`), the schema further describes the structure of the
143+
compound type. Schemas can be placed into a namespace ({{namespaces}}) for
144+
reuse in other schemas.
144145

145146
~~~ json
146147
{
@@ -168,8 +169,8 @@ schema document MAY contain multiple type declarations and namespaces. The
168169
structure of schema documents is defined in section 3.3
169170
({{document-structure}}).
170171

171-
JSON Structure Core is extensible. All keywords that are not explicitly defined
172-
in this document MAY be used for custom annotations and extensions. This also
172+
JSON Structure is extensible. All keywords that are not explicitly defined in
173+
this document MAY be used for custom annotations and extensions. This also
173174
applies to keywords that begin with the `$` character. A complete list of
174175
reserved keywords is provided in section 3.11 ({{reserved-keywords}}).
175176

@@ -200,10 +201,10 @@ namespaces.
200201

201202
A meta-schema is a schema document that defines the structure and constraints of
202203
another schema document. Meta-schemas are used to validate schema documents and
203-
to ensure that schemas are well-formed and conform to the JSON Structure Core
204+
to ensure that schemas are well-formed and conform to the JSON Structure
204205
specification.
205206

206-
The meta-schemas for JSON Structure Core and the extension specifications are
207+
The meta-schemas for JSON Structure and the extension specifications are
207208
enumerated in the Appendix: Metaschemas ({{schema}}).
208209

209210
Meta-schemas can extend existing meta-schemas by adding new keywords or
@@ -216,8 +217,8 @@ from the foundational meta-schema.
216217
## Data Types {#data-types}
217218

218219
The data types that can be used with the `type` keyword are categorized into
219-
JSON Primitive Types, Extended Types, Compound Types, and compound reusable
220-
types {{reusable-types}}.
220+
JSON primitive types, extended types, compound types, and reusable types
221+
{{reusable-types}}.
221222

222223
While JSON Structure builds on the JSON data type model, it introduces a rich
223224
set of types to represent structured data more accurately and to allow more
@@ -283,14 +284,14 @@ the {{Section 6 of RFC8259}} syntax for integers and decimals:
283284

284285
#### `binary` {#binary}
285286

286-
A binary value. The default encoding is base64. The type annotation keywords
287-
`contentEncoding`, `contentCompression`, and `contentMediaType` can be used to
288-
specify the encoding, compression, and media type of the binary data.
287+
A binary value. The default encoding is Base64 {{RFC4648}}. The type annotation
288+
keywords `contentEncoding`, `contentCompression`, and `contentMediaType` can be
289+
used to specify the encoding, compression, and media type of the binary data.
289290

290291
- Base type: `string`
291292
- Constraints:
292293
- The string value MUST be an encoded binary value, with the encoding
293-
specified in the `contentEncoding` keyword. The default encoding is base64.
294+
specified in the `contentEncoding` keyword.
294295

295296
#### `int8` {#int8}
296297

@@ -659,32 +660,35 @@ The root of a JSON Structure document MUST be a JSON object.
659660
The root object MUST contain the following REQUIRED keywords:
660661

661662
- `$id`: A URI that is the unique identifier for this schema document.
662-
- `$schema`: A string that identifies the version of the JSON Structure
663-
specification used.
663+
- `$schema`: A URI that identifies the version and meta-schema of the JSON
664+
Structure specification used.
665+
- `name`: A string that provides a name for the document. If the root object
666+
defines a type, the `name` attribute is also the name of the type.
664667

665668
The presence of both keywords identifies the document as a JSON Structure
666669
document.
667670

668671
The root object MAY contain the following OPTIONAL keywords:
669672

670-
- `$root`: A JSON Pointer that designates a type as the root type for instances.
673+
- `$root`: A JSON Pointer that designates a reusable type as the root type for
674+
instances.
671675
- `definitions`: The root of the type declaration namespace hierarchy.
672676
- `type`: A type declaration for the root type of the document. Mutually
673677
exclusive with `$root`.
674678
- if `type` is present, all annotations and constraints applicable to this
675679
declared root type are also permitted at the root level.
676-
- `name`: A string that defines the name of the root type. Required if `type` is
677-
present.
678680

679681
### Namespaces {#namespaces}
680682

681-
A "namespace" is a JSON object that provides a scope for type declarations or
683+
A namespace is a JSON object that provides a scope for type declarations or
682684
other namespaces. Namespaces MAY be nested within other namespaces.
683685

684686
The `definitions` keyword forms the root of the namespace hierarchy for reusable
685687
type definitions. All type declarations immediately under the `definitions`
686-
keyword are in the root namespace. A `type` definition at the root is placed
687-
into the root namespace as if it were a type declaration under `definitions`.
688+
keyword are in the root namespace.
689+
690+
A `type` definition at the root is placed into the root namespace as if it were
691+
a type declaration under `definitions`.
688692

689693
Any object in the `definitions` map that is not a type declaration is a
690694
namespace.
@@ -747,13 +751,13 @@ Example with the root type in a namespace:
747751
The value of the REQUIRED `$schema` keyword MUST be an absolute URI. The keyword
748752
has different functions in JSON Structure documents and JSON documents.
749753

750-
- In JSON Structure documents, the `$schema` keyword references a meta-schema
751-
that this document conforms to.
752-
- In JSON documents, the `$schema` keyword references a JSON schema document
753-
that defines the structure of the JSON document.
754+
- In JSON Structure schema documents, the `$schema` keyword references a
755+
meta-schema that this document conforms to.
756+
- In JSON documents, the `$schema` keyword references a JSON Structure schema
757+
document that defines the structure of the JSON document.
754758

755-
The value of `$schema` corresponds to the `$id` of the meta-schema or schema
756-
document.
759+
The value of `$schema` MUST correspond to the `$id` of the referenced
760+
meta-schema or schema document.
757761

758762
The `$schema` keyword MUST be used at the root level of the document.
759763

@@ -776,8 +780,8 @@ that its types become available for use in the current document.
776780
### `$id` Keyword {#id-keyword}
777781

778782
The REQUIRED `$id` keyword is used to assign a unique identifier to a JSON
779-
Structure document. The value of `$id` MUST be an absolute URI. It SHOULD be a
780-
resolvable URI (a URL).
783+
Structure schema document. The value of `$id` MUST be an absolute URI. It SHOULD
784+
be a resolvable URI (a URL).
781785

782786
The `$id` keyword is used to identify a schema document in references like
783787
`$schema`.
@@ -800,10 +804,10 @@ Example:
800804

801805
### `$root` Keyword {#root-keyword}
802806

803-
The OPTIONAL `$root` keyword is used to designate any type defined in the
804-
document as the root type for JSON nodes described by this schema document. The
805-
value of `$root` MUST be a valid JSON Pointer that resolves to an existing type
806-
definition inside the `definitions` object.
807+
The OPTIONAL `$root` keyword is used to designate any reusable type defined in
808+
the document as the root type of this schema document. The value of `$root` MUST
809+
be a valid JSON Pointer that resolves to an existing type definition inside the
810+
`definitions` object.
807811

808812
The `$root` keyword MUST only be used once in a document, at the root level. Its
809813
use is mutually exclusive with the `type` keyword.

0 commit comments

Comments
 (0)