jsi 0.8.2 → 0.9.0
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/.yardopts +3 -2
- data/CHANGELOG.md +8 -3
- data/LICENSE.md +2 -3
- data/README.md +68 -31
- data/docs/Glossary.md +313 -0
- data/jsi.gemspec +1 -0
- data/lib/jsi/base/mutability.rb +4 -0
- data/lib/jsi/base/node.rb +63 -24
- data/lib/jsi/base.rb +556 -173
- data/lib/jsi/metaschema_node/bootstrap_schema.rb +106 -56
- data/lib/jsi/metaschema_node.rb +227 -160
- data/lib/jsi/ptr.rb +32 -15
- data/lib/jsi/ref.rb +197 -0
- data/lib/jsi/registry.rb +311 -0
- data/lib/jsi/schema/cxt/child_application.rb +35 -0
- data/lib/jsi/schema/cxt/inplace_application.rb +37 -0
- data/lib/jsi/schema/cxt.rb +80 -0
- data/lib/jsi/schema/dialect.rb +137 -0
- data/lib/jsi/schema/draft04.rb +113 -5
- data/lib/jsi/schema/draft06.rb +123 -5
- data/lib/jsi/schema/draft07.rb +157 -5
- data/lib/jsi/schema/draft202012.rb +303 -0
- data/lib/jsi/schema/dynamic_anchor_map.rb +63 -0
- data/lib/jsi/schema/element.rb +69 -0
- data/lib/jsi/schema/elements/anchor.rb +13 -0
- data/lib/jsi/schema/elements/array_validation.rb +82 -0
- data/lib/jsi/schema/elements/comment.rb +10 -0
- data/lib/jsi/schema/{validation → elements}/const.rb +11 -7
- data/lib/jsi/schema/elements/contains.rb +59 -0
- data/lib/jsi/schema/elements/contains_minmax.rb +91 -0
- data/lib/jsi/schema/elements/content_encoding.rb +10 -0
- data/lib/jsi/schema/elements/content_media_type.rb +10 -0
- data/lib/jsi/schema/elements/content_schema.rb +16 -0
- data/lib/jsi/schema/elements/default.rb +11 -0
- data/lib/jsi/schema/elements/definitions.rb +19 -0
- data/lib/jsi/schema/elements/dependencies.rb +99 -0
- data/lib/jsi/schema/elements/dependent_required.rb +49 -0
- data/lib/jsi/schema/elements/dependent_schemas.rb +69 -0
- data/lib/jsi/schema/elements/dynamic_ref.rb +69 -0
- data/lib/jsi/schema/elements/enum.rb +26 -0
- data/lib/jsi/schema/elements/examples.rb +10 -0
- data/lib/jsi/schema/elements/format.rb +10 -0
- data/lib/jsi/schema/elements/id.rb +30 -0
- data/lib/jsi/schema/elements/if_then_else.rb +82 -0
- data/lib/jsi/schema/elements/info_bool.rb +10 -0
- data/lib/jsi/schema/elements/info_string.rb +10 -0
- data/lib/jsi/schema/elements/items.rb +93 -0
- data/lib/jsi/schema/elements/items_prefixed.rb +96 -0
- data/lib/jsi/schema/elements/not.rb +31 -0
- data/lib/jsi/schema/elements/numeric.rb +137 -0
- data/lib/jsi/schema/elements/numeric_draft04.rb +77 -0
- data/lib/jsi/schema/elements/object_validation.rb +55 -0
- data/lib/jsi/schema/elements/pattern.rb +35 -0
- data/lib/jsi/schema/elements/properties.rb +145 -0
- data/lib/jsi/schema/elements/property_names.rb +48 -0
- data/lib/jsi/schema/elements/ref.rb +62 -0
- data/lib/jsi/schema/elements/required.rb +34 -0
- data/lib/jsi/schema/elements/self.rb +24 -0
- data/lib/jsi/schema/elements/some_of.rb +180 -0
- data/lib/jsi/schema/elements/string_validation.rb +57 -0
- data/lib/jsi/schema/elements/type.rb +43 -0
- data/lib/jsi/schema/elements/unevaluated_items.rb +54 -0
- data/lib/jsi/schema/elements/unevaluated_properties.rb +54 -0
- data/lib/jsi/schema/elements/xschema.rb +10 -0
- data/lib/jsi/schema/elements/xvocabulary.rb +10 -0
- data/lib/jsi/schema/elements.rb +101 -0
- data/lib/jsi/schema/issue.rb +3 -4
- data/lib/jsi/schema/schema_ancestor_node.rb +103 -50
- data/lib/jsi/schema/vocabulary.rb +36 -0
- data/lib/jsi/schema.rb +519 -337
- data/lib/jsi/schema_classes.rb +168 -124
- data/lib/jsi/schema_set.rb +67 -126
- data/lib/jsi/set.rb +23 -0
- data/lib/jsi/simple_wrap.rb +13 -16
- data/lib/jsi/struct.rb +57 -0
- data/lib/jsi/uri.rb +40 -0
- data/lib/jsi/util/private/memo_map.rb +9 -13
- data/lib/jsi/util/private.rb +57 -12
- data/lib/jsi/util/typelike.rb +19 -64
- data/lib/jsi/util.rb +52 -34
- data/lib/jsi/validation/error.rb +41 -2
- data/lib/jsi/validation/result.rb +118 -71
- data/lib/jsi/validation.rb +1 -6
- data/lib/jsi/version.rb +1 -1
- data/lib/jsi.rb +158 -41
- data/lib/schemas/json-schema.org/draft/2020-12/schema.rb +67 -0
- data/lib/schemas/json-schema.org/draft-04/schema.rb +63 -106
- data/lib/schemas/json-schema.org/draft-06/schema.rb +56 -105
- data/lib/schemas/json-schema.org/draft-07/schema.rb +67 -124
- data/readme.rb +3 -3
- data/{resources}/schemas/2020-12_strict.json +19 -0
- data/{resources}/schemas/json-schema.org/draft/2020-12/meta/applicator.json +48 -0
- data/{resources}/schemas/json-schema.org/draft/2020-12/meta/content.json +17 -0
- data/{resources}/schemas/json-schema.org/draft/2020-12/meta/core.json +51 -0
- data/{resources}/schemas/json-schema.org/draft/2020-12/meta/format-annotation.json +14 -0
- data/{resources}/schemas/json-schema.org/draft/2020-12/meta/format-assertion.json +14 -0
- data/{resources}/schemas/json-schema.org/draft/2020-12/meta/meta-data.json +37 -0
- data/{resources}/schemas/json-schema.org/draft/2020-12/meta/unevaluated.json +15 -0
- data/{resources}/schemas/json-schema.org/draft/2020-12/meta/validation.json +98 -0
- data/{resources}/schemas/json-schema.org/draft/2020-12/schema.json +58 -0
- metadata +69 -47
- data/lib/jsi/schema/application/child_application/contains.rb +0 -25
- data/lib/jsi/schema/application/child_application/draft04.rb +0 -21
- data/lib/jsi/schema/application/child_application/draft06.rb +0 -28
- data/lib/jsi/schema/application/child_application/draft07.rb +0 -28
- data/lib/jsi/schema/application/child_application/items.rb +0 -18
- data/lib/jsi/schema/application/child_application/properties.rb +0 -25
- data/lib/jsi/schema/application/child_application.rb +0 -13
- data/lib/jsi/schema/application/draft04.rb +0 -8
- data/lib/jsi/schema/application/draft06.rb +0 -8
- data/lib/jsi/schema/application/draft07.rb +0 -8
- data/lib/jsi/schema/application/inplace_application/dependencies.rb +0 -28
- data/lib/jsi/schema/application/inplace_application/draft04.rb +0 -25
- data/lib/jsi/schema/application/inplace_application/draft06.rb +0 -26
- data/lib/jsi/schema/application/inplace_application/draft07.rb +0 -32
- data/lib/jsi/schema/application/inplace_application/ifthenelse.rb +0 -20
- data/lib/jsi/schema/application/inplace_application/ref.rb +0 -18
- data/lib/jsi/schema/application/inplace_application/someof.rb +0 -44
- data/lib/jsi/schema/application/inplace_application.rb +0 -14
- data/lib/jsi/schema/application.rb +0 -12
- data/lib/jsi/schema/ref.rb +0 -186
- data/lib/jsi/schema/validation/array.rb +0 -69
- data/lib/jsi/schema/validation/contains.rb +0 -25
- data/lib/jsi/schema/validation/dependencies.rb +0 -49
- data/lib/jsi/schema/validation/draft04/minmax.rb +0 -93
- data/lib/jsi/schema/validation/draft04.rb +0 -110
- data/lib/jsi/schema/validation/draft06.rb +0 -120
- data/lib/jsi/schema/validation/draft07.rb +0 -157
- data/lib/jsi/schema/validation/enum.rb +0 -25
- data/lib/jsi/schema/validation/ifthenelse.rb +0 -46
- data/lib/jsi/schema/validation/items.rb +0 -54
- data/lib/jsi/schema/validation/not.rb +0 -20
- data/lib/jsi/schema/validation/numeric.rb +0 -121
- data/lib/jsi/schema/validation/object.rb +0 -45
- data/lib/jsi/schema/validation/pattern.rb +0 -34
- data/lib/jsi/schema/validation/properties.rb +0 -101
- data/lib/jsi/schema/validation/property_names.rb +0 -32
- data/lib/jsi/schema/validation/ref.rb +0 -40
- data/lib/jsi/schema/validation/required.rb +0 -27
- data/lib/jsi/schema/validation/someof.rb +0 -90
- data/lib/jsi/schema/validation/string.rb +0 -47
- data/lib/jsi/schema/validation/type.rb +0 -49
- data/lib/jsi/schema/validation.rb +0 -49
- data/lib/jsi/schema_registry.rb +0 -200
- data/lib/jsi/util/private/attr_struct.rb +0 -141
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://json-schema.org/draft/2020-12/meta/validation",
|
|
4
|
+
"$vocabulary": {
|
|
5
|
+
"https://json-schema.org/draft/2020-12/vocab/validation": true
|
|
6
|
+
},
|
|
7
|
+
"$dynamicAnchor": "meta",
|
|
8
|
+
|
|
9
|
+
"title": "Validation vocabulary meta-schema",
|
|
10
|
+
"type": ["object", "boolean"],
|
|
11
|
+
"properties": {
|
|
12
|
+
"type": {
|
|
13
|
+
"anyOf": [
|
|
14
|
+
{ "$ref": "#/$defs/simpleTypes" },
|
|
15
|
+
{
|
|
16
|
+
"type": "array",
|
|
17
|
+
"items": { "$ref": "#/$defs/simpleTypes" },
|
|
18
|
+
"minItems": 1,
|
|
19
|
+
"uniqueItems": true
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
"const": true,
|
|
24
|
+
"enum": {
|
|
25
|
+
"type": "array",
|
|
26
|
+
"items": true
|
|
27
|
+
},
|
|
28
|
+
"multipleOf": {
|
|
29
|
+
"type": "number",
|
|
30
|
+
"exclusiveMinimum": 0
|
|
31
|
+
},
|
|
32
|
+
"maximum": {
|
|
33
|
+
"type": "number"
|
|
34
|
+
},
|
|
35
|
+
"exclusiveMaximum": {
|
|
36
|
+
"type": "number"
|
|
37
|
+
},
|
|
38
|
+
"minimum": {
|
|
39
|
+
"type": "number"
|
|
40
|
+
},
|
|
41
|
+
"exclusiveMinimum": {
|
|
42
|
+
"type": "number"
|
|
43
|
+
},
|
|
44
|
+
"maxLength": { "$ref": "#/$defs/nonNegativeInteger" },
|
|
45
|
+
"minLength": { "$ref": "#/$defs/nonNegativeIntegerDefault0" },
|
|
46
|
+
"pattern": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"format": "regex"
|
|
49
|
+
},
|
|
50
|
+
"maxItems": { "$ref": "#/$defs/nonNegativeInteger" },
|
|
51
|
+
"minItems": { "$ref": "#/$defs/nonNegativeIntegerDefault0" },
|
|
52
|
+
"uniqueItems": {
|
|
53
|
+
"type": "boolean",
|
|
54
|
+
"default": false
|
|
55
|
+
},
|
|
56
|
+
"maxContains": { "$ref": "#/$defs/nonNegativeInteger" },
|
|
57
|
+
"minContains": {
|
|
58
|
+
"$ref": "#/$defs/nonNegativeInteger",
|
|
59
|
+
"default": 1
|
|
60
|
+
},
|
|
61
|
+
"maxProperties": { "$ref": "#/$defs/nonNegativeInteger" },
|
|
62
|
+
"minProperties": { "$ref": "#/$defs/nonNegativeIntegerDefault0" },
|
|
63
|
+
"required": { "$ref": "#/$defs/stringArray" },
|
|
64
|
+
"dependentRequired": {
|
|
65
|
+
"type": "object",
|
|
66
|
+
"additionalProperties": {
|
|
67
|
+
"$ref": "#/$defs/stringArray"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"$defs": {
|
|
72
|
+
"nonNegativeInteger": {
|
|
73
|
+
"type": "integer",
|
|
74
|
+
"minimum": 0
|
|
75
|
+
},
|
|
76
|
+
"nonNegativeIntegerDefault0": {
|
|
77
|
+
"$ref": "#/$defs/nonNegativeInteger",
|
|
78
|
+
"default": 0
|
|
79
|
+
},
|
|
80
|
+
"simpleTypes": {
|
|
81
|
+
"enum": [
|
|
82
|
+
"array",
|
|
83
|
+
"boolean",
|
|
84
|
+
"integer",
|
|
85
|
+
"null",
|
|
86
|
+
"number",
|
|
87
|
+
"object",
|
|
88
|
+
"string"
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
"stringArray": {
|
|
92
|
+
"type": "array",
|
|
93
|
+
"items": { "type": "string" },
|
|
94
|
+
"uniqueItems": true,
|
|
95
|
+
"default": []
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://json-schema.org/draft/2020-12/schema",
|
|
4
|
+
"$vocabulary": {
|
|
5
|
+
"https://json-schema.org/draft/2020-12/vocab/core": true,
|
|
6
|
+
"https://json-schema.org/draft/2020-12/vocab/applicator": true,
|
|
7
|
+
"https://json-schema.org/draft/2020-12/vocab/unevaluated": true,
|
|
8
|
+
"https://json-schema.org/draft/2020-12/vocab/validation": true,
|
|
9
|
+
"https://json-schema.org/draft/2020-12/vocab/meta-data": true,
|
|
10
|
+
"https://json-schema.org/draft/2020-12/vocab/format-annotation": true,
|
|
11
|
+
"https://json-schema.org/draft/2020-12/vocab/content": true
|
|
12
|
+
},
|
|
13
|
+
"$dynamicAnchor": "meta",
|
|
14
|
+
|
|
15
|
+
"title": "Core and Validation specifications meta-schema",
|
|
16
|
+
"allOf": [
|
|
17
|
+
{"$ref": "meta/core"},
|
|
18
|
+
{"$ref": "meta/applicator"},
|
|
19
|
+
{"$ref": "meta/unevaluated"},
|
|
20
|
+
{"$ref": "meta/validation"},
|
|
21
|
+
{"$ref": "meta/meta-data"},
|
|
22
|
+
{"$ref": "meta/format-annotation"},
|
|
23
|
+
{"$ref": "meta/content"}
|
|
24
|
+
],
|
|
25
|
+
"type": ["object", "boolean"],
|
|
26
|
+
"$comment": "This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",
|
|
27
|
+
"properties": {
|
|
28
|
+
"definitions": {
|
|
29
|
+
"$comment": "\"definitions\" has been replaced by \"$defs\".",
|
|
30
|
+
"type": "object",
|
|
31
|
+
"additionalProperties": { "$dynamicRef": "#meta" },
|
|
32
|
+
"deprecated": true,
|
|
33
|
+
"default": {}
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"$comment": "\"dependencies\" has been split and replaced by \"dependentSchemas\" and \"dependentRequired\" in order to serve their differing semantics.",
|
|
37
|
+
"type": "object",
|
|
38
|
+
"additionalProperties": {
|
|
39
|
+
"anyOf": [
|
|
40
|
+
{ "$dynamicRef": "#meta" },
|
|
41
|
+
{ "$ref": "meta/validation#/$defs/stringArray" }
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"deprecated": true,
|
|
45
|
+
"default": {}
|
|
46
|
+
},
|
|
47
|
+
"$recursiveAnchor": {
|
|
48
|
+
"$comment": "\"$recursiveAnchor\" has been replaced by \"$dynamicAnchor\".",
|
|
49
|
+
"$ref": "meta/core#/$defs/anchorString",
|
|
50
|
+
"deprecated": true
|
|
51
|
+
},
|
|
52
|
+
"$recursiveRef": {
|
|
53
|
+
"$comment": "\"$recursiveRef\" has been replaced by \"$dynamicRef\".",
|
|
54
|
+
"$ref": "meta/core#/$defs/uriReferenceString",
|
|
55
|
+
"deprecated": true
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jsi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ethan
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-02-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|
|
@@ -50,6 +50,7 @@ files:
|
|
|
50
50
|
- CHANGELOG.md
|
|
51
51
|
- LICENSE.md
|
|
52
52
|
- README.md
|
|
53
|
+
- docs/Glossary.md
|
|
53
54
|
- jsi.gemspec
|
|
54
55
|
- lib/jsi.rb
|
|
55
56
|
- lib/jsi/base.rb
|
|
@@ -59,62 +60,72 @@ files:
|
|
|
59
60
|
- lib/jsi/metaschema_node.rb
|
|
60
61
|
- lib/jsi/metaschema_node/bootstrap_schema.rb
|
|
61
62
|
- lib/jsi/ptr.rb
|
|
63
|
+
- lib/jsi/ref.rb
|
|
64
|
+
- lib/jsi/registry.rb
|
|
62
65
|
- lib/jsi/schema.rb
|
|
63
|
-
- lib/jsi/schema/
|
|
64
|
-
- lib/jsi/schema/
|
|
65
|
-
- lib/jsi/schema/
|
|
66
|
-
- lib/jsi/schema/
|
|
67
|
-
- lib/jsi/schema/application/child_application/draft06.rb
|
|
68
|
-
- lib/jsi/schema/application/child_application/draft07.rb
|
|
69
|
-
- lib/jsi/schema/application/child_application/items.rb
|
|
70
|
-
- lib/jsi/schema/application/child_application/properties.rb
|
|
71
|
-
- lib/jsi/schema/application/draft04.rb
|
|
72
|
-
- lib/jsi/schema/application/draft06.rb
|
|
73
|
-
- lib/jsi/schema/application/draft07.rb
|
|
74
|
-
- lib/jsi/schema/application/inplace_application.rb
|
|
75
|
-
- lib/jsi/schema/application/inplace_application/dependencies.rb
|
|
76
|
-
- lib/jsi/schema/application/inplace_application/draft04.rb
|
|
77
|
-
- lib/jsi/schema/application/inplace_application/draft06.rb
|
|
78
|
-
- lib/jsi/schema/application/inplace_application/draft07.rb
|
|
79
|
-
- lib/jsi/schema/application/inplace_application/ifthenelse.rb
|
|
80
|
-
- lib/jsi/schema/application/inplace_application/ref.rb
|
|
81
|
-
- lib/jsi/schema/application/inplace_application/someof.rb
|
|
66
|
+
- lib/jsi/schema/cxt.rb
|
|
67
|
+
- lib/jsi/schema/cxt/child_application.rb
|
|
68
|
+
- lib/jsi/schema/cxt/inplace_application.rb
|
|
69
|
+
- lib/jsi/schema/dialect.rb
|
|
82
70
|
- lib/jsi/schema/draft04.rb
|
|
83
71
|
- lib/jsi/schema/draft06.rb
|
|
84
72
|
- lib/jsi/schema/draft07.rb
|
|
73
|
+
- lib/jsi/schema/draft202012.rb
|
|
74
|
+
- lib/jsi/schema/dynamic_anchor_map.rb
|
|
75
|
+
- lib/jsi/schema/element.rb
|
|
76
|
+
- lib/jsi/schema/elements.rb
|
|
77
|
+
- lib/jsi/schema/elements/anchor.rb
|
|
78
|
+
- lib/jsi/schema/elements/array_validation.rb
|
|
79
|
+
- lib/jsi/schema/elements/comment.rb
|
|
80
|
+
- lib/jsi/schema/elements/const.rb
|
|
81
|
+
- lib/jsi/schema/elements/contains.rb
|
|
82
|
+
- lib/jsi/schema/elements/contains_minmax.rb
|
|
83
|
+
- lib/jsi/schema/elements/content_encoding.rb
|
|
84
|
+
- lib/jsi/schema/elements/content_media_type.rb
|
|
85
|
+
- lib/jsi/schema/elements/content_schema.rb
|
|
86
|
+
- lib/jsi/schema/elements/default.rb
|
|
87
|
+
- lib/jsi/schema/elements/definitions.rb
|
|
88
|
+
- lib/jsi/schema/elements/dependencies.rb
|
|
89
|
+
- lib/jsi/schema/elements/dependent_required.rb
|
|
90
|
+
- lib/jsi/schema/elements/dependent_schemas.rb
|
|
91
|
+
- lib/jsi/schema/elements/dynamic_ref.rb
|
|
92
|
+
- lib/jsi/schema/elements/enum.rb
|
|
93
|
+
- lib/jsi/schema/elements/examples.rb
|
|
94
|
+
- lib/jsi/schema/elements/format.rb
|
|
95
|
+
- lib/jsi/schema/elements/id.rb
|
|
96
|
+
- lib/jsi/schema/elements/if_then_else.rb
|
|
97
|
+
- lib/jsi/schema/elements/info_bool.rb
|
|
98
|
+
- lib/jsi/schema/elements/info_string.rb
|
|
99
|
+
- lib/jsi/schema/elements/items.rb
|
|
100
|
+
- lib/jsi/schema/elements/items_prefixed.rb
|
|
101
|
+
- lib/jsi/schema/elements/not.rb
|
|
102
|
+
- lib/jsi/schema/elements/numeric.rb
|
|
103
|
+
- lib/jsi/schema/elements/numeric_draft04.rb
|
|
104
|
+
- lib/jsi/schema/elements/object_validation.rb
|
|
105
|
+
- lib/jsi/schema/elements/pattern.rb
|
|
106
|
+
- lib/jsi/schema/elements/properties.rb
|
|
107
|
+
- lib/jsi/schema/elements/property_names.rb
|
|
108
|
+
- lib/jsi/schema/elements/ref.rb
|
|
109
|
+
- lib/jsi/schema/elements/required.rb
|
|
110
|
+
- lib/jsi/schema/elements/self.rb
|
|
111
|
+
- lib/jsi/schema/elements/some_of.rb
|
|
112
|
+
- lib/jsi/schema/elements/string_validation.rb
|
|
113
|
+
- lib/jsi/schema/elements/type.rb
|
|
114
|
+
- lib/jsi/schema/elements/unevaluated_items.rb
|
|
115
|
+
- lib/jsi/schema/elements/unevaluated_properties.rb
|
|
116
|
+
- lib/jsi/schema/elements/xschema.rb
|
|
117
|
+
- lib/jsi/schema/elements/xvocabulary.rb
|
|
85
118
|
- lib/jsi/schema/issue.rb
|
|
86
|
-
- lib/jsi/schema/ref.rb
|
|
87
119
|
- lib/jsi/schema/schema_ancestor_node.rb
|
|
88
|
-
- lib/jsi/schema/
|
|
89
|
-
- lib/jsi/schema/validation/array.rb
|
|
90
|
-
- lib/jsi/schema/validation/const.rb
|
|
91
|
-
- lib/jsi/schema/validation/contains.rb
|
|
92
|
-
- lib/jsi/schema/validation/dependencies.rb
|
|
93
|
-
- lib/jsi/schema/validation/draft04.rb
|
|
94
|
-
- lib/jsi/schema/validation/draft04/minmax.rb
|
|
95
|
-
- lib/jsi/schema/validation/draft06.rb
|
|
96
|
-
- lib/jsi/schema/validation/draft07.rb
|
|
97
|
-
- lib/jsi/schema/validation/enum.rb
|
|
98
|
-
- lib/jsi/schema/validation/ifthenelse.rb
|
|
99
|
-
- lib/jsi/schema/validation/items.rb
|
|
100
|
-
- lib/jsi/schema/validation/not.rb
|
|
101
|
-
- lib/jsi/schema/validation/numeric.rb
|
|
102
|
-
- lib/jsi/schema/validation/object.rb
|
|
103
|
-
- lib/jsi/schema/validation/pattern.rb
|
|
104
|
-
- lib/jsi/schema/validation/properties.rb
|
|
105
|
-
- lib/jsi/schema/validation/property_names.rb
|
|
106
|
-
- lib/jsi/schema/validation/ref.rb
|
|
107
|
-
- lib/jsi/schema/validation/required.rb
|
|
108
|
-
- lib/jsi/schema/validation/someof.rb
|
|
109
|
-
- lib/jsi/schema/validation/string.rb
|
|
110
|
-
- lib/jsi/schema/validation/type.rb
|
|
120
|
+
- lib/jsi/schema/vocabulary.rb
|
|
111
121
|
- lib/jsi/schema_classes.rb
|
|
112
|
-
- lib/jsi/schema_registry.rb
|
|
113
122
|
- lib/jsi/schema_set.rb
|
|
123
|
+
- lib/jsi/set.rb
|
|
114
124
|
- lib/jsi/simple_wrap.rb
|
|
125
|
+
- lib/jsi/struct.rb
|
|
126
|
+
- lib/jsi/uri.rb
|
|
115
127
|
- lib/jsi/util.rb
|
|
116
128
|
- lib/jsi/util/private.rb
|
|
117
|
-
- lib/jsi/util/private/attr_struct.rb
|
|
118
129
|
- lib/jsi/util/private/memo_map.rb
|
|
119
130
|
- lib/jsi/util/typelike.rb
|
|
120
131
|
- lib/jsi/validation.rb
|
|
@@ -124,10 +135,21 @@ files:
|
|
|
124
135
|
- lib/schemas/json-schema.org/draft-04/schema.rb
|
|
125
136
|
- lib/schemas/json-schema.org/draft-06/schema.rb
|
|
126
137
|
- lib/schemas/json-schema.org/draft-07/schema.rb
|
|
138
|
+
- lib/schemas/json-schema.org/draft/2020-12/schema.rb
|
|
127
139
|
- readme.rb
|
|
140
|
+
- "{resources}/schemas/2020-12_strict.json"
|
|
128
141
|
- "{resources}/schemas/json-schema.org/draft-04/schema.json"
|
|
129
142
|
- "{resources}/schemas/json-schema.org/draft-06/schema.json"
|
|
130
143
|
- "{resources}/schemas/json-schema.org/draft-07/schema.json"
|
|
144
|
+
- "{resources}/schemas/json-schema.org/draft/2020-12/meta/applicator.json"
|
|
145
|
+
- "{resources}/schemas/json-schema.org/draft/2020-12/meta/content.json"
|
|
146
|
+
- "{resources}/schemas/json-schema.org/draft/2020-12/meta/core.json"
|
|
147
|
+
- "{resources}/schemas/json-schema.org/draft/2020-12/meta/format-annotation.json"
|
|
148
|
+
- "{resources}/schemas/json-schema.org/draft/2020-12/meta/format-assertion.json"
|
|
149
|
+
- "{resources}/schemas/json-schema.org/draft/2020-12/meta/meta-data.json"
|
|
150
|
+
- "{resources}/schemas/json-schema.org/draft/2020-12/meta/unevaluated.json"
|
|
151
|
+
- "{resources}/schemas/json-schema.org/draft/2020-12/meta/validation.json"
|
|
152
|
+
- "{resources}/schemas/json-schema.org/draft/2020-12/schema.json"
|
|
131
153
|
homepage: https://github.com/notEthan/jsi
|
|
132
154
|
licenses:
|
|
133
155
|
- AGPL-3.0
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module JSI
|
|
4
|
-
module Schema::Application::ChildApplication::Contains
|
|
5
|
-
# @private
|
|
6
|
-
def internal_applicate_contains(idx, instance, &block)
|
|
7
|
-
if keyword?('contains')
|
|
8
|
-
contains_schema = subschema(['contains'])
|
|
9
|
-
|
|
10
|
-
child_idx_valid = Hash.new { |h, i| h[i] = contains_schema.instance_valid?(instance[i]) }
|
|
11
|
-
|
|
12
|
-
if child_idx_valid[idx]
|
|
13
|
-
yield contains_schema
|
|
14
|
-
else
|
|
15
|
-
instance_valid = instance.each_index.any? { |i| child_idx_valid[i] }
|
|
16
|
-
|
|
17
|
-
unless instance_valid
|
|
18
|
-
# invalid application: if contains_schema does not validate against any child, it applies to every child
|
|
19
|
-
yield contains_schema
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module JSI
|
|
4
|
-
module Schema::Application::ChildApplication::Draft04
|
|
5
|
-
include Schema::Application::ChildApplication::Items
|
|
6
|
-
include Schema::Application::ChildApplication::Properties
|
|
7
|
-
|
|
8
|
-
# @private
|
|
9
|
-
def internal_child_applicate_keywords(token, instance, &block)
|
|
10
|
-
if instance.respond_to?(:to_ary)
|
|
11
|
-
# 5.3.1. additionalItems and items
|
|
12
|
-
internal_applicate_items(token, &block)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
if instance.respond_to?(:to_hash)
|
|
16
|
-
# 5.4.4. additionalProperties, properties and patternProperties
|
|
17
|
-
internal_applicate_properties(token, &block)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module JSI
|
|
4
|
-
module Schema::Application::ChildApplication::Draft06
|
|
5
|
-
include Schema::Application::ChildApplication::Items
|
|
6
|
-
include Schema::Application::ChildApplication::Contains
|
|
7
|
-
include Schema::Application::ChildApplication::Properties
|
|
8
|
-
|
|
9
|
-
# @private
|
|
10
|
-
def internal_child_applicate_keywords(token, instance, &block)
|
|
11
|
-
if instance.respond_to?(:to_ary)
|
|
12
|
-
# json-schema-validation 6.9. items
|
|
13
|
-
# json-schema-validation 6.10. additionalItems
|
|
14
|
-
internal_applicate_items(token, &block)
|
|
15
|
-
|
|
16
|
-
# json-schema-validation 6.14. contains
|
|
17
|
-
internal_applicate_contains(token, instance, &block)
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
if instance.respond_to?(:to_hash)
|
|
21
|
-
# json-schema-validation 6.18. properties
|
|
22
|
-
# json-schema-validation 6.19. patternProperties
|
|
23
|
-
# json-schema-validation 6.20. additionalProperties
|
|
24
|
-
internal_applicate_properties(token, &block)
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module JSI
|
|
4
|
-
module Schema::Application::ChildApplication::Draft07
|
|
5
|
-
include Schema::Application::ChildApplication::Items
|
|
6
|
-
include Schema::Application::ChildApplication::Contains
|
|
7
|
-
include Schema::Application::ChildApplication::Properties
|
|
8
|
-
|
|
9
|
-
# @private
|
|
10
|
-
def internal_child_applicate_keywords(token, instance, &block)
|
|
11
|
-
if instance.respond_to?(:to_ary)
|
|
12
|
-
# 6.4.1. items
|
|
13
|
-
# 6.4.2. additionalItems
|
|
14
|
-
internal_applicate_items(token, &block)
|
|
15
|
-
|
|
16
|
-
# 6.4.6. contains
|
|
17
|
-
internal_applicate_contains(token, instance, &block)
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
if instance.respond_to?(:to_hash)
|
|
21
|
-
# 6.5.4. properties
|
|
22
|
-
# 6.5.5. patternProperties
|
|
23
|
-
# 6.5.6. additionalProperties
|
|
24
|
-
internal_applicate_properties(token, &block)
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module JSI
|
|
4
|
-
module Schema::Application::ChildApplication::Items
|
|
5
|
-
# @private
|
|
6
|
-
def internal_applicate_items(idx, &block)
|
|
7
|
-
if keyword?('items') && schema_content['items'].respond_to?(:to_ary)
|
|
8
|
-
if schema_content['items'].each_index.to_a.include?(idx)
|
|
9
|
-
yield subschema(['items', idx])
|
|
10
|
-
elsif keyword?('additionalItems')
|
|
11
|
-
yield subschema(['additionalItems'])
|
|
12
|
-
end
|
|
13
|
-
elsif keyword?('items')
|
|
14
|
-
yield subschema(['items'])
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module JSI
|
|
4
|
-
module Schema::Application::ChildApplication::Properties
|
|
5
|
-
# @private
|
|
6
|
-
def internal_applicate_properties(property_name, &block)
|
|
7
|
-
apply_additional = true
|
|
8
|
-
if keyword?('properties') && schema_content['properties'].respond_to?(:to_hash) && schema_content['properties'].key?(property_name)
|
|
9
|
-
apply_additional = false
|
|
10
|
-
yield subschema(['properties', property_name])
|
|
11
|
-
end
|
|
12
|
-
if keyword?('patternProperties') && schema_content['patternProperties'].respond_to?(:to_hash)
|
|
13
|
-
schema_content['patternProperties'].each_key do |pattern|
|
|
14
|
-
if pattern.respond_to?(:to_str) && property_name.to_s =~ Regexp.new(pattern) # TODO map pattern to ruby syntax
|
|
15
|
-
apply_additional = false
|
|
16
|
-
yield subschema(['patternProperties', pattern])
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
if apply_additional && keyword?('additionalProperties')
|
|
21
|
-
yield subschema(['additionalProperties'])
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module JSI
|
|
4
|
-
module Schema::Application::ChildApplication
|
|
5
|
-
autoload :Draft04, 'jsi/schema/application/child_application/draft04'
|
|
6
|
-
autoload :Draft06, 'jsi/schema/application/child_application/draft06'
|
|
7
|
-
autoload :Draft07, 'jsi/schema/application/child_application/draft07'
|
|
8
|
-
|
|
9
|
-
autoload :Items, 'jsi/schema/application/child_application/items'
|
|
10
|
-
autoload :Contains, 'jsi/schema/application/child_application/contains'
|
|
11
|
-
autoload :Properties, 'jsi/schema/application/child_application/properties'
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module JSI
|
|
4
|
-
module Schema::Application::InplaceApplication::Dependencies
|
|
5
|
-
# @private
|
|
6
|
-
def internal_applicate_dependencies(instance, visited_refs, &block)
|
|
7
|
-
if keyword?('dependencies')
|
|
8
|
-
value = schema_content['dependencies']
|
|
9
|
-
# This keyword's value MUST be an object. Each property specifies a dependency. Each dependency
|
|
10
|
-
# value MUST be an array or a valid JSON Schema.
|
|
11
|
-
if value.respond_to?(:to_hash)
|
|
12
|
-
value.each_pair do |property_name, dependency|
|
|
13
|
-
if dependency.respond_to?(:to_ary)
|
|
14
|
-
# noop: array-form dependencies has no inplace applicator schema
|
|
15
|
-
else
|
|
16
|
-
# If the dependency value is a subschema, and the dependency key is a
|
|
17
|
-
# property in the instance, the entire instance must validate against
|
|
18
|
-
# the dependency value.
|
|
19
|
-
if instance.respond_to?(:to_hash) && instance.key?(property_name)
|
|
20
|
-
subschema(['dependencies', property_name]).each_inplace_applicator_schema(instance, visited_refs: visited_refs, &block)
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module JSI
|
|
4
|
-
module Schema::Application::InplaceApplication::Draft04
|
|
5
|
-
include Schema::Application::InplaceApplication::Ref
|
|
6
|
-
include Schema::Application::InplaceApplication::Dependencies
|
|
7
|
-
include Schema::Application::InplaceApplication::SomeOf
|
|
8
|
-
|
|
9
|
-
# @private
|
|
10
|
-
def internal_inplace_applicate_keywords(instance, visited_refs, &block)
|
|
11
|
-
internal_applicate_ref(instance, visited_refs, throw_done: true, &block)
|
|
12
|
-
|
|
13
|
-
# self is the first applicator schema if $ref has not short-circuited it
|
|
14
|
-
yield self
|
|
15
|
-
|
|
16
|
-
# 5.4.5. dependencies
|
|
17
|
-
internal_applicate_dependencies(instance, visited_refs, &block)
|
|
18
|
-
|
|
19
|
-
# 5.5.3. allOf
|
|
20
|
-
# 5.5.4. anyOf
|
|
21
|
-
# 5.5.5. oneOf
|
|
22
|
-
internal_applicate_someOf(instance, visited_refs, &block)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module JSI
|
|
4
|
-
module Schema::Application::InplaceApplication::Draft06
|
|
5
|
-
include Schema::Application::InplaceApplication::Ref
|
|
6
|
-
include Schema::Application::InplaceApplication::Dependencies
|
|
7
|
-
include Schema::Application::InplaceApplication::SomeOf
|
|
8
|
-
|
|
9
|
-
# @private
|
|
10
|
-
def internal_inplace_applicate_keywords(instance, visited_refs, &block)
|
|
11
|
-
# json-schema 8. Schema references with $ref
|
|
12
|
-
internal_applicate_ref(instance, visited_refs, throw_done: true, &block)
|
|
13
|
-
|
|
14
|
-
# self is the first applicator schema if $ref has not short-circuited it
|
|
15
|
-
yield self
|
|
16
|
-
|
|
17
|
-
# json-schema-validation 6.21. dependencies
|
|
18
|
-
internal_applicate_dependencies(instance, visited_refs, &block)
|
|
19
|
-
|
|
20
|
-
# json-schema-validation 6.26. allOf
|
|
21
|
-
# json-schema-validation 6.27. anyOf
|
|
22
|
-
# json-schema-validation 6.28. oneOf
|
|
23
|
-
internal_applicate_someOf(instance, visited_refs, &block)
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module JSI
|
|
4
|
-
module Schema::Application::InplaceApplication::Draft07
|
|
5
|
-
include Schema::Application::InplaceApplication::Ref
|
|
6
|
-
include Schema::Application::InplaceApplication::Dependencies
|
|
7
|
-
include Schema::Application::InplaceApplication::IfThenElse
|
|
8
|
-
include Schema::Application::InplaceApplication::SomeOf
|
|
9
|
-
|
|
10
|
-
# @private
|
|
11
|
-
def internal_inplace_applicate_keywords(instance, visited_refs, &block)
|
|
12
|
-
# json-schema 8. Schema references with $ref
|
|
13
|
-
internal_applicate_ref(instance, visited_refs, throw_done: true, &block)
|
|
14
|
-
|
|
15
|
-
# self is the first applicator schema if $ref has not short-circuited it
|
|
16
|
-
block.call(self)
|
|
17
|
-
|
|
18
|
-
# 6.5.7. dependencies
|
|
19
|
-
internal_applicate_dependencies(instance, visited_refs, &block)
|
|
20
|
-
|
|
21
|
-
# 6.6.1. if
|
|
22
|
-
# 6.6.2. then
|
|
23
|
-
# 6.6.3. else
|
|
24
|
-
internal_applicate_ifthenelse(instance, visited_refs, &block)
|
|
25
|
-
|
|
26
|
-
# 6.7.1. allOf
|
|
27
|
-
# 6.7.2. anyOf
|
|
28
|
-
# 6.7.3. oneOf
|
|
29
|
-
internal_applicate_someOf(instance, visited_refs, &block)
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module JSI
|
|
4
|
-
module Schema::Application::InplaceApplication::IfThenElse
|
|
5
|
-
# @private
|
|
6
|
-
def internal_applicate_ifthenelse(instance, visited_refs, &block)
|
|
7
|
-
if keyword?('if')
|
|
8
|
-
if subschema(['if']).instance_valid?(instance)
|
|
9
|
-
if keyword?('then')
|
|
10
|
-
subschema(['then']).each_inplace_applicator_schema(instance, visited_refs: visited_refs, &block)
|
|
11
|
-
end
|
|
12
|
-
else
|
|
13
|
-
if keyword?('else')
|
|
14
|
-
subschema(['else']).each_inplace_applicator_schema(instance, visited_refs: visited_refs, &block)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|