json_skooma 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -1
- data/README.md +38 -0
- data/lib/json_skooma/formatters.rb +56 -0
- data/lib/json_skooma/keywords/value_schemas.rb +13 -3
- data/lib/json_skooma/registry.rb +14 -3
- data/lib/json_skooma/version.rb +1 -1
- metadata +17 -40
- data/data/draft-2019-09/README.md +0 -60
- data/data/draft-2019-09/hyper-schema.json +0 -26
- data/data/draft-2019-09/links.json +0 -91
- data/data/draft-2019-09/meta/applicator.json +0 -53
- data/data/draft-2019-09/meta/content.json +0 -14
- data/data/draft-2019-09/meta/core.json +0 -54
- data/data/draft-2019-09/meta/format.json +0 -11
- data/data/draft-2019-09/meta/hyper-schema.json +0 -26
- data/data/draft-2019-09/meta/meta-data.json +0 -34
- data/data/draft-2019-09/meta/validation.json +0 -95
- data/data/draft-2019-09/output/hyper-schema.json +0 -62
- data/data/draft-2019-09/output/schema.json +0 -86
- data/data/draft-2019-09/output/verbose-example.json +0 -130
- data/data/draft-2019-09/schema.json +0 -42
- data/data/draft-2020-12/README.md +0 -89
- data/data/draft-2020-12/adr/README.md +0 -15
- data/data/draft-2020-12/archive/hyper-schema.json +0 -28
- data/data/draft-2020-12/archive/links.json +0 -93
- data/data/draft-2020-12/archive/meta/hyper-schema.json +0 -30
- data/data/draft-2020-12/hyper-schema.json +0 -27
- data/data/draft-2020-12/links.json +0 -85
- data/data/draft-2020-12/meta/applicator.json +0 -45
- data/data/draft-2020-12/meta/content.json +0 -14
- data/data/draft-2020-12/meta/core.json +0 -48
- data/data/draft-2020-12/meta/format-annotation.json +0 -11
- data/data/draft-2020-12/meta/format-assertion.json +0 -11
- data/data/draft-2020-12/meta/hyper-schema.json +0 -26
- data/data/draft-2020-12/meta/meta-data.json +0 -34
- data/data/draft-2020-12/meta/unevaluated.json +0 -12
- data/data/draft-2020-12/meta/validation.json +0 -95
- data/data/draft-2020-12/output/hyper-schema.json +0 -62
- data/data/draft-2020-12/output/schema.json +0 -96
- data/data/draft-2020-12/output/verbose-example.json +0 -130
- data/data/draft-2020-12/schema.json +0 -58
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0c9b29eaf20596ff580928de020aadb7e54bc70e449ae85bdcabc03124b205c5
|
|
4
|
+
data.tar.gz: 4a3b4949d29cd5a56785776929234907320d7df6ce86101a6527a5c29e8795c2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 39af1cfcaf160b8b871a0d3e3f1a27f01f3327db0f767feb691b836591f7c07ebab5595f57317a229f366e32ecac56a2f4a0b718bb09821a2462186c14edb835
|
|
7
|
+
data.tar.gz: 4d279524b54059e230873d9b602017e299a7f76ef4ab8c907d0c540be036739c430a4c3821346aa9ae20cb63b808ed1b45373b847ab2f8bedfe6428372eb0418
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning].
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.2.6] - 2026-06-10
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- New `:annotated` output format interleaves the instance data with annotations collected during evaluation (`title`/`description` by default, configurable via `keywords:`). Each node becomes `{"title" => ..., "value" => ...}`, mirroring the shape of the data — handy for rendering values alongside their schema-defined labels. ([@skryukov], [#13](https://github.com/skryukov/json_skooma/issues/13))
|
|
15
|
+
- `JSONSkooma::UnexpectedSchemaClassError < RegistryError` is now raised by `Registry#schema` when the resolved fragment does not match the expected class. Extensions can rescue this specific error instead of matching on message text. ([@skryukov])
|
|
16
|
+
- `Registry#load_json(uri)` is now public so extensions can load a raw document via registered sources. ([@skryukov])
|
|
17
|
+
- `Keywords::ValueSchemas.default_schema_class=` lets extensions set the fallback class used to wrap sub-schemas when a keyword does not specify its own `schema_value_class`. ([@skryukov])
|
|
18
|
+
|
|
19
|
+
## [0.2.5] - 2024-12-25
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- Support Ruby 3.4. ([@skryukov])
|
|
24
|
+
|
|
10
25
|
## [0.2.4] - 2024-10-31
|
|
11
26
|
|
|
12
27
|
### Added
|
|
@@ -57,7 +72,9 @@ and this project adheres to [Semantic Versioning].
|
|
|
57
72
|
[@killondark]: https://github.com/killondark
|
|
58
73
|
[@skryukov]: https://github.com/skryukov
|
|
59
74
|
|
|
60
|
-
[Unreleased]: https://github.com/skryukov/json_skooma/compare/v0.2.
|
|
75
|
+
[Unreleased]: https://github.com/skryukov/json_skooma/compare/v0.2.6...HEAD
|
|
76
|
+
[0.2.6]: https://github.com/skryukov/json_skooma/compare/v0.2.5...v0.2.6
|
|
77
|
+
[0.2.5]: https://github.com/skryukov/json_skooma/compare/v0.2.4...v0.2.5
|
|
61
78
|
[0.2.4]: https://github.com/skryukov/json_skooma/compare/v0.2.3...v0.2.4
|
|
62
79
|
[0.2.3]: https://github.com/skryukov/json_skooma/compare/v0.2.2...v0.2.3
|
|
63
80
|
[0.2.2]: https://github.com/skryukov/json_skooma/compare/v0.2.1...v0.2.2
|
data/README.md
CHANGED
|
@@ -156,6 +156,44 @@ schema_registry.add_source(
|
|
|
156
156
|
# - http://remote.example/product_definition.yaml -> http://example.com/schemas/product_definition.yaml
|
|
157
157
|
```
|
|
158
158
|
|
|
159
|
+
### Extracting annotations
|
|
160
|
+
|
|
161
|
+
The `:annotated` output format re-shapes collected annotations into a hash that mirrors your data: every node becomes a hash of its annotations plus a `"value"` key holding the original value. Useful for rendering data alongside the `title`/`description` texts defined in the schema.
|
|
162
|
+
|
|
163
|
+
```ruby
|
|
164
|
+
schema = JSONSkooma::JSONSchema.new({
|
|
165
|
+
"$schema" => "https://json-schema.org/draft/2020-12/schema",
|
|
166
|
+
"type" => "object",
|
|
167
|
+
"properties" => {
|
|
168
|
+
"user_id" => {
|
|
169
|
+
"type" => "integer",
|
|
170
|
+
"title" => "User Identifier",
|
|
171
|
+
"description" => "A unique numeric ID for the user."
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
result = schema.evaluate({"user_id" => 123})
|
|
177
|
+
|
|
178
|
+
result.output(:annotated)
|
|
179
|
+
# {"user_id"=>
|
|
180
|
+
# {"title"=>"User Identifier",
|
|
181
|
+
# "description"=>"A unique numeric ID for the user.",
|
|
182
|
+
# "value"=>123}}
|
|
183
|
+
|
|
184
|
+
# Pick which annotation keywords to include (default: title and description):
|
|
185
|
+
result.output(:annotated, keywords: %w[title description default deprecated])
|
|
186
|
+
|
|
187
|
+
# Rename the wrapper key:
|
|
188
|
+
result.output(:annotated, value_key: "data")
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Notes:
|
|
192
|
+
|
|
193
|
+
- Annotations contributed through `$ref`/`allOf` are merged into the same location; if several subschemas annotate the same keyword at the same location, the last one wins.
|
|
194
|
+
- Annotations from failed subschemas (e.g. a non-matching `anyOf` branch) are dropped, as the spec prescribes.
|
|
195
|
+
- The root node is returned unwrapped to keep the output data-shaped, so annotations on the root schema itself are not included.
|
|
196
|
+
|
|
159
197
|
## Alternatives
|
|
160
198
|
|
|
161
199
|
- [json_schemer](https://github.com/davishmcclurg/json_schemer) – Draft 4, 6, 7, 2019-09 and 2020-12 compliant
|
|
@@ -133,5 +133,61 @@ module JSONSkooma
|
|
|
133
133
|
end
|
|
134
134
|
end
|
|
135
135
|
register :verbose, Verbose
|
|
136
|
+
|
|
137
|
+
# Re-shapes collected annotations into a hash that mirrors the instance
|
|
138
|
+
# data: every node (except the root) becomes a hash of its annotations
|
|
139
|
+
# plus a "value" key holding the original value (with nested nodes wrapped
|
|
140
|
+
# the same way). Annotations contributed through $ref/allOf land on the
|
|
141
|
+
# same instance location, so they merge naturally; annotations from failed
|
|
142
|
+
# subschemas are dropped, per the JSON Schema spec.
|
|
143
|
+
#
|
|
144
|
+
# result.output(:annotated)
|
|
145
|
+
# # => {"user_id" => {"title" => "User Identifier", "value" => 123}, ...}
|
|
146
|
+
#
|
|
147
|
+
# Options:
|
|
148
|
+
# keywords: list of annotation keywords to include (default: title, description)
|
|
149
|
+
# value_key: key under which the original value is placed (default: "value")
|
|
150
|
+
module Annotated
|
|
151
|
+
DEFAULT_KEYWORDS = %w[title description].freeze
|
|
152
|
+
|
|
153
|
+
class << self
|
|
154
|
+
def call(result, keywords: DEFAULT_KEYWORDS, value_key: "value", **_options)
|
|
155
|
+
annotations = {}
|
|
156
|
+
collect(result, keywords.map(&:to_s), annotations)
|
|
157
|
+
represent(result.instance, annotations, value_key, root: true)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
private
|
|
161
|
+
|
|
162
|
+
def collect(node, keywords, annotations)
|
|
163
|
+
return unless node.valid?
|
|
164
|
+
|
|
165
|
+
if node.annotation && keywords.include?(node.key)
|
|
166
|
+
annotation = node.annotation
|
|
167
|
+
annotation = annotation.value if annotation.is_a?(JSONNode)
|
|
168
|
+
(annotations[node.instance.path.to_s] ||= {})[node.key] = annotation
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
node.each_children { |child| collect(child, keywords, annotations) }
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
def represent(instance, annotations, value_key, root: false)
|
|
175
|
+
value =
|
|
176
|
+
case instance.type
|
|
177
|
+
when "object"
|
|
178
|
+
instance.transform_values { |child| represent(child, annotations, value_key) }
|
|
179
|
+
when "array"
|
|
180
|
+
instance.map { |child| represent(child, annotations, value_key) }
|
|
181
|
+
else
|
|
182
|
+
instance.value
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
return value if root
|
|
186
|
+
|
|
187
|
+
(annotations[instance.path.to_s] || {}).merge(value_key => value)
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
register :annotated, Annotated
|
|
136
192
|
end
|
|
137
193
|
end
|
|
@@ -4,6 +4,8 @@ module JSONSkooma
|
|
|
4
4
|
module Keywords
|
|
5
5
|
module ValueSchemas
|
|
6
6
|
class << self
|
|
7
|
+
attr_writer :default_schema_class
|
|
8
|
+
|
|
7
9
|
def [](key)
|
|
8
10
|
value_schemas&.[](key) or raise "Unknown value schema: #{key}, known schemas: #{value_schemas.keys.inspect}"
|
|
9
11
|
end
|
|
@@ -12,6 +14,14 @@ module JSONSkooma
|
|
|
12
14
|
(self.value_schemas ||= {})[key] = klass
|
|
13
15
|
end
|
|
14
16
|
|
|
17
|
+
# Class used to wrap schema values when a keyword does not set its own
|
|
18
|
+
# `schema_value_class`. Extensions (e.g. Skooma) override this to plug
|
|
19
|
+
# their own JSONSchema subclass into every sub-schema created by the
|
|
20
|
+
# built-in applicator keywords.
|
|
21
|
+
def default_schema_class
|
|
22
|
+
@default_schema_class || JSONSchema
|
|
23
|
+
end
|
|
24
|
+
|
|
15
25
|
private
|
|
16
26
|
|
|
17
27
|
attr_accessor :value_schemas
|
|
@@ -21,7 +31,7 @@ module JSONSkooma
|
|
|
21
31
|
def wrap_value(value)
|
|
22
32
|
return super unless value.is_a?(Hash) || value.is_a?(TrueClass) || value.is_a?(FalseClass)
|
|
23
33
|
|
|
24
|
-
(self.class.schema_value_class ||
|
|
34
|
+
(self.class.schema_value_class || ValueSchemas.default_schema_class).new(
|
|
25
35
|
value,
|
|
26
36
|
parent: parent_schema,
|
|
27
37
|
key: key,
|
|
@@ -46,7 +56,7 @@ module JSONSkooma
|
|
|
46
56
|
value,
|
|
47
57
|
parent: parent_schema,
|
|
48
58
|
key: key,
|
|
49
|
-
item_class: self.class.schema_value_class ||
|
|
59
|
+
item_class: self.class.schema_value_class || ValueSchemas.default_schema_class,
|
|
50
60
|
registry: parent_schema.registry,
|
|
51
61
|
cache_id: parent_schema.cache_id
|
|
52
62
|
)
|
|
@@ -69,7 +79,7 @@ module JSONSkooma
|
|
|
69
79
|
value,
|
|
70
80
|
parent: parent_schema,
|
|
71
81
|
key: key,
|
|
72
|
-
item_class: self.class.schema_value_class ||
|
|
82
|
+
item_class: self.class.schema_value_class || ValueSchemas.default_schema_class,
|
|
73
83
|
registry: parent_schema.registry,
|
|
74
84
|
cache_id: parent_schema.cache_id
|
|
75
85
|
)
|
data/lib/json_skooma/registry.rb
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
module JSONSkooma
|
|
4
4
|
class RegistryError < Error; end
|
|
5
5
|
|
|
6
|
+
# Raised when a ref resolves to an object that is not the class the caller expected.
|
|
7
|
+
# Extension points (e.g. typed OpenAPI refs) can rescue this and load the subtree
|
|
8
|
+
# as the right class without matching on error message text.
|
|
9
|
+
class UnexpectedSchemaClassError < RegistryError
|
|
10
|
+
attr_reader :uri, :expected_class
|
|
11
|
+
|
|
12
|
+
def initialize(uri, expected_class)
|
|
13
|
+
@uri = uri
|
|
14
|
+
@expected_class = expected_class
|
|
15
|
+
super("The object referenced by #{uri} is not #{expected_class}")
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
6
19
|
class Registry
|
|
7
20
|
class << self
|
|
8
21
|
attr_accessor :registries
|
|
@@ -79,7 +92,7 @@ module JSONSkooma
|
|
|
79
92
|
schema = JSONPointer.new(uri.fragment).eval(schema) if uri.fragment
|
|
80
93
|
return schema if schema.is_a?(expected_class)
|
|
81
94
|
|
|
82
|
-
raise
|
|
95
|
+
raise UnexpectedSchemaClassError.new(uri, expected_class)
|
|
83
96
|
end
|
|
84
97
|
|
|
85
98
|
def add_metaschema(uri, default_core_vocabulary_uri = nil, *default_vocabulary_uris)
|
|
@@ -113,8 +126,6 @@ module JSONSkooma
|
|
|
113
126
|
@uri_sources[uri] = source
|
|
114
127
|
end
|
|
115
128
|
|
|
116
|
-
private
|
|
117
|
-
|
|
118
129
|
def load_json(uri)
|
|
119
130
|
candidates = @uri_sources
|
|
120
131
|
.select { |source_uri| uri.to_s.start_with?(source_uri) }
|
data/lib/json_skooma/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: json_skooma
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Svyatoslav Kryukov
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: bigdecimal
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0'
|
|
13
26
|
- !ruby/object:Gem::Dependency
|
|
14
27
|
name: zeitwerk
|
|
15
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -76,40 +89,6 @@ files:
|
|
|
76
89
|
- CHANGELOG.md
|
|
77
90
|
- LICENSE.txt
|
|
78
91
|
- README.md
|
|
79
|
-
- data/draft-2019-09/README.md
|
|
80
|
-
- data/draft-2019-09/hyper-schema.json
|
|
81
|
-
- data/draft-2019-09/links.json
|
|
82
|
-
- data/draft-2019-09/meta/applicator.json
|
|
83
|
-
- data/draft-2019-09/meta/content.json
|
|
84
|
-
- data/draft-2019-09/meta/core.json
|
|
85
|
-
- data/draft-2019-09/meta/format.json
|
|
86
|
-
- data/draft-2019-09/meta/hyper-schema.json
|
|
87
|
-
- data/draft-2019-09/meta/meta-data.json
|
|
88
|
-
- data/draft-2019-09/meta/validation.json
|
|
89
|
-
- data/draft-2019-09/output/hyper-schema.json
|
|
90
|
-
- data/draft-2019-09/output/schema.json
|
|
91
|
-
- data/draft-2019-09/output/verbose-example.json
|
|
92
|
-
- data/draft-2019-09/schema.json
|
|
93
|
-
- data/draft-2020-12/README.md
|
|
94
|
-
- data/draft-2020-12/adr/README.md
|
|
95
|
-
- data/draft-2020-12/archive/hyper-schema.json
|
|
96
|
-
- data/draft-2020-12/archive/links.json
|
|
97
|
-
- data/draft-2020-12/archive/meta/hyper-schema.json
|
|
98
|
-
- data/draft-2020-12/hyper-schema.json
|
|
99
|
-
- data/draft-2020-12/links.json
|
|
100
|
-
- data/draft-2020-12/meta/applicator.json
|
|
101
|
-
- data/draft-2020-12/meta/content.json
|
|
102
|
-
- data/draft-2020-12/meta/core.json
|
|
103
|
-
- data/draft-2020-12/meta/format-annotation.json
|
|
104
|
-
- data/draft-2020-12/meta/format-assertion.json
|
|
105
|
-
- data/draft-2020-12/meta/hyper-schema.json
|
|
106
|
-
- data/draft-2020-12/meta/meta-data.json
|
|
107
|
-
- data/draft-2020-12/meta/unevaluated.json
|
|
108
|
-
- data/draft-2020-12/meta/validation.json
|
|
109
|
-
- data/draft-2020-12/output/hyper-schema.json
|
|
110
|
-
- data/draft-2020-12/output/schema.json
|
|
111
|
-
- data/draft-2020-12/output/verbose-example.json
|
|
112
|
-
- data/draft-2020-12/schema.json
|
|
113
92
|
- lib/json_skooma.rb
|
|
114
93
|
- lib/json_skooma/dialects/draft201909.rb
|
|
115
94
|
- lib/json_skooma/dialects/draft202012.rb
|
|
@@ -222,7 +201,6 @@ metadata:
|
|
|
222
201
|
homepage_uri: https://github.com/skryukov/json_skooma
|
|
223
202
|
source_code_uri: https://github.com/skryukov/json_skooma
|
|
224
203
|
rubygems_mfa_required: 'true'
|
|
225
|
-
post_install_message:
|
|
226
204
|
rdoc_options: []
|
|
227
205
|
require_paths:
|
|
228
206
|
- lib
|
|
@@ -237,8 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
237
215
|
- !ruby/object:Gem::Version
|
|
238
216
|
version: '0'
|
|
239
217
|
requirements: []
|
|
240
|
-
rubygems_version:
|
|
241
|
-
signing_key:
|
|
218
|
+
rubygems_version: 4.0.6
|
|
242
219
|
specification_version: 4
|
|
243
220
|
summary: I bring some sugar for your JSONs.
|
|
244
221
|
test_files: []
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# Welcome to JSON Schema
|
|
2
|
-
|
|
3
|
-
JSON Schema is a vocabulary that allows you to validate, annotate, and manipulate JSON documents.
|
|
4
|
-
|
|
5
|
-
This repository contains the sources for the **work in progress** of the next set of JSON Schema IETF Internet Draft (I-D) documents.
|
|
6
|
-
For the latest released I-Ds, please see the [Specification page](http://json-schema.org/documentation.html) on the website.
|
|
7
|
-
|
|
8
|
-
## Call for contributions and feedback
|
|
9
|
-
|
|
10
|
-
Reviews, comments and suggestions are most welcome!
|
|
11
|
-
Please read our [guidelines for contributing](CONTRIBUTING.md).
|
|
12
|
-
|
|
13
|
-
## Status
|
|
14
|
-
For the current status of issues and pull requests, please see the following labels
|
|
15
|
-
|
|
16
|
-
[](https://github.com/json-schema-org/json-schema-spec/issues?q=is%3Aopen+is%3Aissue+label%3A%22Status%3A+Available%22) [](https://github.com/json-schema-org/json-schema-spec/labels/Status:%20In%20Progress) [](https://github.com/json-schema-org/json-schema-spec/labels/Status%3A%20Review%20Needed)
|
|
17
|
-
|
|
18
|
-
[](https://github.com/json-schema-org/json-schema-spec/labels/Priority%3A%20Critical) [](https://github.com/json-schema-org/json-schema-spec/labels/Priority%3A%20High) [](https://github.com/json-schema-org/json-schema-spec/labels/Priority%3A%20Medium) [](https://github.com/json-schema-org/json-schema-spec/labels/Priority%3A%20Low)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Labels are assigned based on [Sensible Github Labels](https://github.com/Relequestual/sensible-github-labels).
|
|
23
|
-
|
|
24
|
-
## Contents
|
|
25
|
-
|
|
26
|
-
* Makefile - scripts to build the Internet-Draft txt/html
|
|
27
|
-
* _Internet-Draft sources_
|
|
28
|
-
* jsonschema-core.xml - source for JSON Schema's "core" I-D
|
|
29
|
-
* jsonschema-validation.xml - source for the validation vocabulary I-D
|
|
30
|
-
* jsonschema-hyperschema.xml - source for the hyper-schema vocabulary I-D
|
|
31
|
-
* relative-json-pointer.xml - source for the Relative JSON Pointer I-D
|
|
32
|
-
* _meta-schemas and recommended output formats_
|
|
33
|
-
* schema.json - JSON Schema "core" and Validation meta-schema
|
|
34
|
-
* hyper-schema.json - JSON Hyper-Schema meta-schema
|
|
35
|
-
* links.json - JSON Hyper-Schema's Link Description Object meta-schema
|
|
36
|
-
* hyper-schema-output.json - The recommended output format for JSON Hyper-Schema links
|
|
37
|
-
|
|
38
|
-
Type "make" at a shell to build the .txt and .html spec files.
|
|
39
|
-
|
|
40
|
-
Descriptions of the xml2rfc, I-D documents, and RFC processes:
|
|
41
|
-
|
|
42
|
-
* https://xml2rfc.tools.ietf.org/authoring/draft-mrose-writing-rfcs.html
|
|
43
|
-
* https://www.ietf.org/tao.html
|
|
44
|
-
* https://www.ietf.org/ietf-ftp/1id-guidelines.html
|
|
45
|
-
* https://www.rfc-editor.org/rfc/rfc7322.txt
|
|
46
|
-
|
|
47
|
-
## Test suites
|
|
48
|
-
|
|
49
|
-
Conformance tests for JSON Schema and its vocabularies may be found
|
|
50
|
-
[in their own repository](https://github.com/json-schema-org/JSON-Schema-Test-Suite).
|
|
51
|
-
|
|
52
|
-
## The website
|
|
53
|
-
|
|
54
|
-
The JSON Schema web site is at http://json-schema.org/
|
|
55
|
-
|
|
56
|
-
The source for the website is [maintained in a separate repository](https://github.com/json-schema-org/website).
|
|
57
|
-
|
|
58
|
-
## License
|
|
59
|
-
|
|
60
|
-
The source material in this repository is licensed under the AFL or BSD license.
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2019-09/hyper-schema",
|
|
3
|
-
"$id": "https://json-schema.org/draft/2019-09/hyper-schema",
|
|
4
|
-
"$vocabulary": {
|
|
5
|
-
"https://json-schema.org/draft/2019-09/vocab/core": true,
|
|
6
|
-
"https://json-schema.org/draft/2019-09/vocab/applicator": true,
|
|
7
|
-
"https://json-schema.org/draft/2019-09/vocab/validation": true,
|
|
8
|
-
"https://json-schema.org/draft/2019-09/vocab/meta-data": true,
|
|
9
|
-
"https://json-schema.org/draft/2019-09/vocab/format": false,
|
|
10
|
-
"https://json-schema.org/draft/2019-09/vocab/content": true,
|
|
11
|
-
"https://json-schema.org/draft/2019-09/vocab/hyper-schema": true
|
|
12
|
-
},
|
|
13
|
-
"$recursiveAnchor": true,
|
|
14
|
-
|
|
15
|
-
"title": "JSON Hyper-Schema",
|
|
16
|
-
"allOf": [
|
|
17
|
-
{"$ref": "https://json-schema.org/draft/2019-09/schema"},
|
|
18
|
-
{"$ref": "https://json-schema.org/draft/2019-09/meta/hyper-schema"}
|
|
19
|
-
],
|
|
20
|
-
"links": [
|
|
21
|
-
{
|
|
22
|
-
"rel": "self",
|
|
23
|
-
"href": "{+%24id}"
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
|
3
|
-
"$id": "https://json-schema.org/draft/2019-09/links",
|
|
4
|
-
"title": "Link Description Object",
|
|
5
|
-
"allOf": [
|
|
6
|
-
{ "required": [ "rel", "href" ] },
|
|
7
|
-
{ "$ref": "#/$defs/noRequiredFields" }
|
|
8
|
-
],
|
|
9
|
-
"$defs": {
|
|
10
|
-
"noRequiredFields": {
|
|
11
|
-
"type": "object",
|
|
12
|
-
"properties": {
|
|
13
|
-
"anchor": {
|
|
14
|
-
"type": "string",
|
|
15
|
-
"format": "uri-template"
|
|
16
|
-
},
|
|
17
|
-
"anchorPointer": {
|
|
18
|
-
"type": "string",
|
|
19
|
-
"anyOf": [
|
|
20
|
-
{ "format": "json-pointer" },
|
|
21
|
-
{ "format": "relative-json-pointer" }
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
|
-
"rel": {
|
|
25
|
-
"anyOf": [
|
|
26
|
-
{ "type": "string" },
|
|
27
|
-
{
|
|
28
|
-
"type": "array",
|
|
29
|
-
"items": { "type": "string" },
|
|
30
|
-
"minItems": 1
|
|
31
|
-
}
|
|
32
|
-
]
|
|
33
|
-
},
|
|
34
|
-
"href": {
|
|
35
|
-
"type": "string",
|
|
36
|
-
"format": "uri-template"
|
|
37
|
-
},
|
|
38
|
-
"hrefSchema": {
|
|
39
|
-
"$ref": "https://json-schema.org/draft/2019-09/hyper-schema",
|
|
40
|
-
"default": false
|
|
41
|
-
},
|
|
42
|
-
"templatePointers": {
|
|
43
|
-
"type": "object",
|
|
44
|
-
"additionalProperties": {
|
|
45
|
-
"type": "string",
|
|
46
|
-
"anyOf": [
|
|
47
|
-
{ "format": "json-pointer" },
|
|
48
|
-
{ "format": "relative-json-pointer" }
|
|
49
|
-
]
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"templateRequired": {
|
|
53
|
-
"type": "array",
|
|
54
|
-
"items": {
|
|
55
|
-
"type": "string"
|
|
56
|
-
},
|
|
57
|
-
"uniqueItems": true
|
|
58
|
-
},
|
|
59
|
-
"title": {
|
|
60
|
-
"type": "string"
|
|
61
|
-
},
|
|
62
|
-
"description": {
|
|
63
|
-
"type": "string"
|
|
64
|
-
},
|
|
65
|
-
"targetSchema": {
|
|
66
|
-
"$ref": "https://json-schema.org/draft/2019-09/hyper-schema",
|
|
67
|
-
"default": true
|
|
68
|
-
},
|
|
69
|
-
"targetMediaType": {
|
|
70
|
-
"type": "string"
|
|
71
|
-
},
|
|
72
|
-
"targetHints": { },
|
|
73
|
-
"headerSchema": {
|
|
74
|
-
"$ref": "https://json-schema.org/draft/2019-09/hyper-schema",
|
|
75
|
-
"default": true
|
|
76
|
-
},
|
|
77
|
-
"submissionMediaType": {
|
|
78
|
-
"type": "string",
|
|
79
|
-
"default": "application/json"
|
|
80
|
-
},
|
|
81
|
-
"submissionSchema": {
|
|
82
|
-
"$ref": "https://json-schema.org/draft/2019-09/hyper-schema",
|
|
83
|
-
"default": true
|
|
84
|
-
},
|
|
85
|
-
"$comment": {
|
|
86
|
-
"type": "string"
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
|
3
|
-
"$id": "https://json-schema.org/draft/2019-09/meta/applicator",
|
|
4
|
-
"$recursiveAnchor": true,
|
|
5
|
-
|
|
6
|
-
"title": "Applicator vocabulary meta-schema",
|
|
7
|
-
"type": ["object", "boolean"],
|
|
8
|
-
"properties": {
|
|
9
|
-
"additionalItems": { "$recursiveRef": "#" },
|
|
10
|
-
"unevaluatedItems": { "$recursiveRef": "#" },
|
|
11
|
-
"items": {
|
|
12
|
-
"anyOf": [
|
|
13
|
-
{ "$recursiveRef": "#" },
|
|
14
|
-
{ "$ref": "#/$defs/schemaArray" }
|
|
15
|
-
]
|
|
16
|
-
},
|
|
17
|
-
"contains": { "$recursiveRef": "#" },
|
|
18
|
-
"additionalProperties": { "$recursiveRef": "#" },
|
|
19
|
-
"unevaluatedProperties": { "$recursiveRef": "#" },
|
|
20
|
-
"properties": {
|
|
21
|
-
"type": "object",
|
|
22
|
-
"additionalProperties": { "$recursiveRef": "#" },
|
|
23
|
-
"default": {}
|
|
24
|
-
},
|
|
25
|
-
"patternProperties": {
|
|
26
|
-
"type": "object",
|
|
27
|
-
"additionalProperties": { "$recursiveRef": "#" },
|
|
28
|
-
"propertyNames": { "format": "regex" },
|
|
29
|
-
"default": {}
|
|
30
|
-
},
|
|
31
|
-
"dependentSchemas": {
|
|
32
|
-
"type": "object",
|
|
33
|
-
"additionalProperties": {
|
|
34
|
-
"$recursiveRef": "#"
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"propertyNames": { "$recursiveRef": "#" },
|
|
38
|
-
"if": { "$recursiveRef": "#" },
|
|
39
|
-
"then": { "$recursiveRef": "#" },
|
|
40
|
-
"else": { "$recursiveRef": "#" },
|
|
41
|
-
"allOf": { "$ref": "#/$defs/schemaArray" },
|
|
42
|
-
"anyOf": { "$ref": "#/$defs/schemaArray" },
|
|
43
|
-
"oneOf": { "$ref": "#/$defs/schemaArray" },
|
|
44
|
-
"not": { "$recursiveRef": "#" }
|
|
45
|
-
},
|
|
46
|
-
"$defs": {
|
|
47
|
-
"schemaArray": {
|
|
48
|
-
"type": "array",
|
|
49
|
-
"minItems": 1,
|
|
50
|
-
"items": { "$recursiveRef": "#" }
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
|
3
|
-
"$id": "https://json-schema.org/draft/2019-09/meta/content",
|
|
4
|
-
"$recursiveAnchor": true,
|
|
5
|
-
|
|
6
|
-
"title": "Content vocabulary meta-schema",
|
|
7
|
-
|
|
8
|
-
"type": ["object", "boolean"],
|
|
9
|
-
"properties": {
|
|
10
|
-
"contentMediaType": { "type": "string" },
|
|
11
|
-
"contentEncoding": { "type": "string" },
|
|
12
|
-
"contentSchema": { "$recursiveRef": "#" }
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
|
3
|
-
"$id": "https://json-schema.org/draft/2019-09/meta/core",
|
|
4
|
-
"$recursiveAnchor": true,
|
|
5
|
-
|
|
6
|
-
"title": "Core vocabulary meta-schema",
|
|
7
|
-
"type": ["object", "boolean"],
|
|
8
|
-
"properties": {
|
|
9
|
-
"$id": {
|
|
10
|
-
"type": "string",
|
|
11
|
-
"format": "uri-reference",
|
|
12
|
-
"$comment": "Non-empty fragments not allowed.",
|
|
13
|
-
"pattern": "^[^#]*#?$"
|
|
14
|
-
},
|
|
15
|
-
"$schema": {
|
|
16
|
-
"type": "string",
|
|
17
|
-
"format": "uri"
|
|
18
|
-
},
|
|
19
|
-
"$anchor": {
|
|
20
|
-
"type": "string",
|
|
21
|
-
"pattern": "^[A-Za-z][-A-Za-z0-9.:_]*$"
|
|
22
|
-
},
|
|
23
|
-
"$ref": {
|
|
24
|
-
"type": "string",
|
|
25
|
-
"format": "uri-reference"
|
|
26
|
-
},
|
|
27
|
-
"$recursiveRef": {
|
|
28
|
-
"type": "string",
|
|
29
|
-
"format": "uri-reference"
|
|
30
|
-
},
|
|
31
|
-
"$recursiveAnchor": {
|
|
32
|
-
"type": "boolean",
|
|
33
|
-
"default": false
|
|
34
|
-
},
|
|
35
|
-
"$vocabulary": {
|
|
36
|
-
"type": "object",
|
|
37
|
-
"propertyNames": {
|
|
38
|
-
"type": "string",
|
|
39
|
-
"format": "uri"
|
|
40
|
-
},
|
|
41
|
-
"additionalProperties": {
|
|
42
|
-
"type": "boolean"
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
"$comment": {
|
|
46
|
-
"type": "string"
|
|
47
|
-
},
|
|
48
|
-
"$defs": {
|
|
49
|
-
"type": "object",
|
|
50
|
-
"additionalProperties": { "$recursiveRef": "#" },
|
|
51
|
-
"default": {}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
|
3
|
-
"$id": "https://json-schema.org/draft/2019-09/meta/format",
|
|
4
|
-
"$recursiveAnchor": true,
|
|
5
|
-
|
|
6
|
-
"title": "Format vocabulary meta-schema",
|
|
7
|
-
"type": ["object", "boolean"],
|
|
8
|
-
"properties": {
|
|
9
|
-
"format": { "type": "string" }
|
|
10
|
-
}
|
|
11
|
-
}
|