Skip to content

Commit 4e9e93b

Browse files
committed
some properties are defined in core
1 parent fc59a3e commit 4e9e93b

File tree

1 file changed

+54
-77
lines changed

1 file changed

+54
-77
lines changed

jsonschema-machine-output.md renamed to jsonschema-validation-output-machines.md

Lines changed: 54 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
# A Specification for Machine-Readable JSON Schema Output
1+
# A Specification for Machine-Readable Output for JSON Schema Validation and Annotation
22

33
JSON Schema is defined to be platform-independent. As such, to increase compatibility across platforms, implementations SHOULD conform to a standard validation output format. This section describes the minimum requirements that consumers will need to properly interpret validation results.
44

55
## Schema Identifiers
66

7-
The output defined in this specification requires that the evaluation root be defined with an absolute IRI. In the event an absolute IRI has not been defined, the implementation MUST generate one.
7+
The output defined in this specification requires that the evaluation root be defined with an absolute IRI, i.e. using the `$id` keyword. In the event an absolute IRI has not been defined, the implementation MUST generate one.
88

99
There are no requirements on the form of IRI itself, except that it MUST be absolute.
1010

1111
## Textual Format and Encoding
1212

13-
JSON Schema output is defined using the JSON Schema data instance model as described in [JSON Schema, section 4.2.1](). Implementations MAY deviate from this as supported by their specific languages and platforms, however it is RECOMMENDED that the output be convertible to the JSON format defined herein via serialization or other means.
13+
JSON Schema output is defined using the JSON Schema data instance model as described in [JSON Schema](#json-schema) "Instance Data Model". Implementations MAY deviate from this in their internal modelling, as supported by their specific languages and platforms, however it is RECOMMENDED that the output be convertible to the JSON format defined herein via serialization or other means.
1414

1515
## Output Formats
1616

17-
This specification defines three output formats. See the "Output Structure" section for the requirements of each format.
17+
This specification defines three output formats. See [Output Structure]{#output-structure} for the requirements of each format.
1818

1919
- **Flag** - A boolean which simply indicates the overall validation result with no further details.
2020
- **List** - Provides validation information in a flat list structure.
@@ -24,85 +24,21 @@ An implementation MUST provide the "flag" format and SHOULD provide at least one
2424

2525
## Minimum Information
2626

27-
Beyond the simplistic "flag" output, additional information is useful to aid in debugging a schema or instance. Each sub-result MUST contain the information contained within this section at a minimum, unless otherwise specified.
27+
Beyond the simplistic "flag" output, additional information is useful to aid in debugging evaluation of an instance by a schema. Each sub-result MUST contain the [validation result](#validation-result) for the associated subschema as well as the following information defined by [JSON Schema](#json-schema) "Output Formatting".
28+
29+
- Evaluation Path
30+
- Schema Location
31+
- Instance Location
2832

2933
A single object that contains all of these components is considered an "output unit."
3034

3135
Implementations MAY elect to provide additional information.
3236

33-
### Evaluation path
34-
35-
The evaluation path to the schema object that produced the output unit. The value MUST be expressed as a JSON Pointer, and it MUST include any by-reference applicators such as `$ref` or `$dynamicRef`.
36-
37-
<!--
38-
The schema may not actually have a value at the location indicated by this pointer. It is provided as an indication of the traversal path only.
39-
-->
40-
41-
```
42-
/properties/width/$ref/allOf/1
43-
```
44-
45-
Note that this pointer may not be resolvable by the normal JSON Pointer process due to the inclusion of these by-reference applicator keywords.
46-
47-
The JSON key for this information is `evaluationPath`.
48-
49-
### Schema Location
37+
### Validation Result {#validation-result}
5038

51-
The absolute, dereferenced location of the schema object that produced the output unit. The value MUST be expressed using the canonical IRI of the relevant schema resource plus a JSON Pointer fragment that indicates the schema object that produced the output. It MUST NOT include by-reference applicators such as `$ref` or `$dynamicRef`.
52-
53-
<!--
54-
Note that "absolute" here is in the sense of "absolute filesystem path" (meaning the complete location) rather than the "absolute-IRI" terminology from RFC 3987 (meaning with scheme and without fragment). Schema locations will have a fragment in order to identify the specific schema object.
55-
-->
56-
57-
```
58-
https://example.com/schemas/common#/$defs/allOf/1
59-
```
60-
61-
The JSON key for this information is `schemaLocation`.
62-
63-
### Instance Location
64-
65-
The location of the JSON value within the instance being validated. The value MUST be expressed as a JSON Pointer.
66-
67-
The JSON key for this information is `instanceLocation`.
68-
69-
### Errors
70-
71-
Any errors produced by the validation. This property MUST NOT be included if the validation was successful. The value
72-
for this property MUST be an object where the keys are the names of keywords and the values are the error message produced by the associated keyword.
73-
74-
If the subschema itself is producing the error, that error MUST be listed with an empty string key.
75-
76-
<!--
77-
Although there may be other cases where a subschema can produce an error, the most common case is the "false" schema. In cases like these, there is no keyword that produces the error, so there is nothing to use as a key. Thus the empty string is used instead.
78-
-->
39+
The validation result is a boolean that indicates whether the local instance passed validation by the local subschema.
7940

80-
The specific wording for the message is not defined by this specification. Implementations will need to provide this.
81-
82-
The JSON key for this information is `errors`.
83-
84-
### Annotations
85-
86-
Any annotations produced by the evaluation. This property MUST NOT be included if the validation result of the containing subschema was unsuccessful.
87-
88-
The value for this property MUST be an object where the keys are the names of keywords and the values are the annotations
89-
produced by the associated keyword.
90-
91-
Each keyword defines its own annotation data type (e.g. `properties` produces a list of object keys, whereas `title` produces a string).
92-
93-
The JSON key for this information is `annotations`.
94-
95-
### Dropped Annotations
96-
97-
Any annotations produced and subsequently dropped by the evaluation due to an unsuccessful validation result of the containing subschema. This property MAY be included if the validation result of the containing subschema was unsuccessful. It MUST NOT be included if the local validation result of the containing subschema was successful.
98-
99-
Implementations that wish to provide these annotations MUST NOT provide them as their default behavior. These annotations MUST only be included by explicitly configuring the implementation to do so.
100-
101-
The value for this property MUST be an object where the keys are the names of keywords and the values are the annotations produced by the associated keyword.
102-
103-
Each keyword defines its own annotation data type (e.g. `properties` produces a list of object keys, whereas `title` produces a string).
104-
105-
The JSON key for this information is `droppedAnnotations`.
41+
The JSON key for these additional results is `valid`.
10642

10743
### Results from Subschemas
10844

@@ -116,7 +52,7 @@ The sequence of output units within this list is not specified and MAY be determ
11652

11753
The JSON key for these additional results is `details`.
11854

119-
## Output Structure
55+
## Output Structure {#output-structure}
12056

12157
The output MUST be an object containing a boolean property named `valid`. When additional information about the result is required, the output MUST also contain `details` as described below.
12258

@@ -603,3 +539,44 @@ Reasons to omit output units may include, but are not limited to:
603539
Output units which include annotations MUST NOT be pruned.
604540

605541
Implementations which provide this behavior SHOULD provide configuration mechanisms appropriate for their users' needs.
542+
543+
## References
544+
545+
### Normative References
546+
547+
#### [RFC2119] {#rfc2119}
548+
549+
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14,
550+
RFC 2119, DOI 10.17487/RFC2119, March 1997,
551+
<<https://www.rfc-editor.org/info/rfc2119>>.
552+
553+
#### [RFC3986] {#rfc3986}
554+
555+
Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier
556+
(URI): Generic Syntax", STD 66, RFC 3986, DOI 10.17487/RFC3986, January 2005,
557+
<<https://www.rfc-editor.org/info/rfc3986>>.
558+
559+
#### [RFC3987] {#rfc3987}
560+
561+
Duerst, M. and M. Suignard, "Internationalized Resource Identifiers (IRIs)", RFC
562+
3987, DOI 10.17487/RFC3987, January 2005,
563+
<<https://www.rfc-editor.org/info/rfc3987>>.
564+
565+
#### [RFC6901] {#rfc6901}
566+
567+
Bryan, P., Ed., Zyp, K., and M. Nottingham, Ed., "JavaScript Object Notation
568+
(JSON) Pointer", RFC 6901, DOI 10.17487/RFC6901, April 2013,
569+
<<https://www.rfc-editor.org/info/rfc6901>>.
570+
571+
#### [RFC8259] {#rfc8259}
572+
573+
Bray, T., Ed., "The JavaScript Object Notation (JSON) Data Interchange Format",
574+
STD 90, RFC 8259, DOI 10.17487/RFC8259, December 2017,
575+
<<https://www.rfc-editor.org/info/rfc8259>>.
576+
577+
#### [json-schema] {#json-schema}
578+
579+
Wright, A., Andrews, H., Hutton, B., and G. Dennis, "JSON Schema: A Media Type
580+
for Describing JSON Documents", Work in Progress, Internet-Draft,
581+
draft-bhutton-json-schema-01, June 2022,
582+
<<https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-01>>.

0 commit comments

Comments
 (0)