json_skooma 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -1
- data/data/draft-2019-09/README.md +1 -1
- data/data/draft-2019-09/meta/applicator.json +0 -3
- data/data/draft-2019-09/meta/content.json +0 -3
- data/data/draft-2019-09/meta/core.json +0 -3
- data/data/draft-2019-09/meta/format.json +0 -3
- data/data/draft-2019-09/meta/hyper-schema.json +0 -3
- data/data/draft-2019-09/meta/meta-data.json +0 -3
- data/data/draft-2019-09/meta/validation.json +0 -3
- data/data/draft-2020-12/README.md +1 -1
- data/data/draft-2020-12/meta/applicator.json +0 -3
- data/data/draft-2020-12/meta/content.json +0 -3
- data/data/draft-2020-12/meta/core.json +0 -3
- data/data/draft-2020-12/meta/format-annotation.json +0 -3
- data/data/draft-2020-12/meta/format-assertion.json +0 -3
- data/data/draft-2020-12/meta/hyper-schema.json +0 -3
- data/data/draft-2020-12/meta/meta-data.json +0 -3
- data/data/draft-2020-12/meta/unevaluated.json +0 -3
- data/data/draft-2020-12/meta/validation.json +0 -3
- data/lib/json_skooma/dialects/draft201909.rb +1 -1
- data/lib/json_skooma/formatters.rb +1 -1
- data/lib/json_skooma/json_pointer.rb +1 -1
- data/lib/json_skooma/keywords/core/dynamic_ref.rb +1 -1
- data/lib/json_skooma/keywords/draft_2019_09/unevaluated_items.rb +1 -0
- data/lib/json_skooma/keywords/draft_2019_09/unevaluated_properties.rb +45 -0
- data/lib/json_skooma/keywords/unevaluated/unevaluated_items.rb +1 -0
- data/lib/json_skooma/keywords/unevaluated/unevaluated_properties.rb +1 -0
- data/lib/json_skooma/validators/idn_hostname.rb +2 -1
- data/lib/json_skooma/validators/time.rb +1 -1
- data/lib/json_skooma/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dce896a1a7c67eef175462387309d5635c989b6dc73feefe0b9e298008f3fe00
|
4
|
+
data.tar.gz: f072c2ff39c2231a7505aebc78d1825f6d1da203062c9611f5ada1dea4dc76ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa5e600b9a45004f9fd4fd980a2290e7fc0d4e1920e81a843b2888f26f860bfb2b4cdce2ae953f4e319ab42c6dd89eddddaf17184dd56a37e4d50f4b2dde0d8e
|
7
|
+
data.tar.gz: d9dde950d0fc71f0e0f5a9a8d4876ffe042cc96fc0fc801eb45f185d740de8505a551b98ddad65af60bad0421929e4f04c369a6ac88cb5bf97a93fd6ecf836cf
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning].
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [0.2.2] - 2023-04-09
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
|
14
|
+
- Fix `$dynamicAnchor` boolean evaluation. ([@skryukov])
|
15
|
+
|
16
|
+
## [0.2.1] - 2023-12-03
|
17
|
+
|
18
|
+
### Fixed
|
19
|
+
|
20
|
+
- Make `unevaluated*` keyword respect reference keywords. ([@skryukov])
|
21
|
+
- Fix `:basic` output. ([@skryukov])
|
22
|
+
|
10
23
|
## [0.2.0] - 2023-10-23
|
11
24
|
|
12
25
|
### Added
|
@@ -30,7 +43,9 @@ and this project adheres to [Semantic Versioning].
|
|
30
43
|
|
31
44
|
[@skryukov]: https://github.com/skryukov
|
32
45
|
|
33
|
-
[Unreleased]: https://github.com/skryukov/json_skooma/compare/v0.2.
|
46
|
+
[Unreleased]: https://github.com/skryukov/json_skooma/compare/v0.2.2...HEAD
|
47
|
+
[0.2.2]: https://github.com/skryukov/json_skooma/compare/v0.2.1...v0.2.2
|
48
|
+
[0.2.1]: https://github.com/skryukov/json_skooma/compare/v0.2.0...v0.2.1
|
34
49
|
[0.2.0]: https://github.com/skryukov/json_skooma/compare/v0.1.0...v0.2.0
|
35
50
|
[0.1.0]: https://github.com/skryukov/json_skooma/commits/v0.1.0
|
36
51
|
|
@@ -53,7 +53,7 @@ Conformance tests for JSON Schema and its vocabularies may be found
|
|
53
53
|
|
54
54
|
The JSON Schema web site is at http://json-schema.org/
|
55
55
|
|
56
|
-
The source for the website is [maintained in a separate repository](https://github.com/json-schema-org/
|
56
|
+
The source for the website is [maintained in a separate repository](https://github.com/json-schema-org/website).
|
57
57
|
|
58
58
|
## License
|
59
59
|
|
@@ -1,9 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
3
3
|
"$id": "https://json-schema.org/draft/2019-09/meta/applicator",
|
4
|
-
"$vocabulary": {
|
5
|
-
"https://json-schema.org/draft/2019-09/vocab/applicator": true
|
6
|
-
},
|
7
4
|
"$recursiveAnchor": true,
|
8
5
|
|
9
6
|
"title": "Applicator vocabulary meta-schema",
|
@@ -1,9 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
3
3
|
"$id": "https://json-schema.org/draft/2019-09/meta/content",
|
4
|
-
"$vocabulary": {
|
5
|
-
"https://json-schema.org/draft/2019-09/vocab/content": true
|
6
|
-
},
|
7
4
|
"$recursiveAnchor": true,
|
8
5
|
|
9
6
|
"title": "Content vocabulary meta-schema",
|
@@ -1,9 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
3
3
|
"$id": "https://json-schema.org/draft/2019-09/meta/core",
|
4
|
-
"$vocabulary": {
|
5
|
-
"https://json-schema.org/draft/2019-09/vocab/core": true
|
6
|
-
},
|
7
4
|
"$recursiveAnchor": true,
|
8
5
|
|
9
6
|
"title": "Core vocabulary meta-schema",
|
@@ -1,9 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
3
3
|
"$id": "https://json-schema.org/draft/2019-09/meta/format",
|
4
|
-
"$vocabulary": {
|
5
|
-
"https://json-schema.org/draft/2019-09/vocab/format": true
|
6
|
-
},
|
7
4
|
"$recursiveAnchor": true,
|
8
5
|
|
9
6
|
"title": "Format vocabulary meta-schema",
|
@@ -1,9 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "https://json-schema.org/draft/2019-09/hyper-schema",
|
3
3
|
"$id": "https://json-schema.org/draft/2019-09/meta/hyper-schema",
|
4
|
-
"$vocabulary": {
|
5
|
-
"https://json-schema.org/draft/2019-09/vocab/hyper-schema": true
|
6
|
-
},
|
7
4
|
"$recursiveAnchor": true,
|
8
5
|
|
9
6
|
"title": "JSON Hyper-Schema Vocabulary Schema",
|
@@ -1,9 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
3
3
|
"$id": "https://json-schema.org/draft/2019-09/meta/meta-data",
|
4
|
-
"$vocabulary": {
|
5
|
-
"https://json-schema.org/draft/2019-09/vocab/meta-data": true
|
6
|
-
},
|
7
4
|
"$recursiveAnchor": true,
|
8
5
|
|
9
6
|
"title": "Meta-data vocabulary meta-schema",
|
@@ -1,9 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
3
3
|
"$id": "https://json-schema.org/draft/2019-09/meta/validation",
|
4
|
-
"$vocabulary": {
|
5
|
-
"https://json-schema.org/draft/2019-09/vocab/validation": true
|
6
|
-
},
|
7
4
|
"$recursiveAnchor": true,
|
8
5
|
|
9
6
|
"title": "Validation vocabulary meta-schema",
|
@@ -53,7 +53,7 @@ Conformance tests for JSON Schema and its vocabularies may be found
|
|
53
53
|
|
54
54
|
The JSON Schema web site is at http://json-schema.org/
|
55
55
|
|
56
|
-
The source for the website is [maintained in a separate repository](https://github.com/json-schema-org/
|
56
|
+
The source for the website is [maintained in a separate repository](https://github.com/json-schema-org/website).
|
57
57
|
|
58
58
|
## Contributors
|
59
59
|
|
@@ -1,9 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
3
|
"$id": "https://json-schema.org/draft/2020-12/meta/applicator",
|
4
|
-
"$vocabulary": {
|
5
|
-
"https://json-schema.org/draft/2020-12/vocab/applicator": true
|
6
|
-
},
|
7
4
|
"$dynamicAnchor": "meta",
|
8
5
|
|
9
6
|
"title": "Applicator vocabulary meta-schema",
|
@@ -1,9 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
3
|
"$id": "https://json-schema.org/draft/2020-12/meta/content",
|
4
|
-
"$vocabulary": {
|
5
|
-
"https://json-schema.org/draft/2020-12/vocab/content": true
|
6
|
-
},
|
7
4
|
"$dynamicAnchor": "meta",
|
8
5
|
|
9
6
|
"title": "Content vocabulary meta-schema",
|
@@ -1,9 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
3
|
"$id": "https://json-schema.org/draft/2020-12/meta/core",
|
4
|
-
"$vocabulary": {
|
5
|
-
"https://json-schema.org/draft/2020-12/vocab/core": true
|
6
|
-
},
|
7
4
|
"$dynamicAnchor": "meta",
|
8
5
|
|
9
6
|
"title": "Core vocabulary meta-schema",
|
@@ -1,9 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
3
|
"$id": "https://json-schema.org/draft/2020-12/meta/format-annotation",
|
4
|
-
"$vocabulary": {
|
5
|
-
"https://json-schema.org/draft/2020-12/vocab/format-annotation": true
|
6
|
-
},
|
7
4
|
"$dynamicAnchor": "meta",
|
8
5
|
|
9
6
|
"title": "Format vocabulary meta-schema for annotation results",
|
@@ -1,9 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
3
|
"$id": "https://json-schema.org/draft/2020-12/meta/format-assertion",
|
4
|
-
"$vocabulary": {
|
5
|
-
"https://json-schema.org/draft/2020-12/vocab/format-assertion": true
|
6
|
-
},
|
7
4
|
"$dynamicAnchor": "meta",
|
8
5
|
|
9
6
|
"title": "Format vocabulary meta-schema for assertion results",
|
@@ -1,9 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/hyper-schema",
|
3
3
|
"$id": "https://json-schema.org/draft/2020-12/meta/hyper-schema",
|
4
|
-
"$vocabulary": {
|
5
|
-
"https://json-schema.org/draft/2019-09/vocab/hyper-schema": true
|
6
|
-
},
|
7
4
|
"$dynamicAnchor": "meta",
|
8
5
|
|
9
6
|
"title": "JSON Hyper-Schema Vocabulary Schema",
|
@@ -1,9 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
3
|
"$id": "https://json-schema.org/draft/2020-12/meta/meta-data",
|
4
|
-
"$vocabulary": {
|
5
|
-
"https://json-schema.org/draft/2020-12/vocab/meta-data": true
|
6
|
-
},
|
7
4
|
"$dynamicAnchor": "meta",
|
8
5
|
|
9
6
|
"title": "Meta-data vocabulary meta-schema",
|
@@ -1,9 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
3
|
"$id": "https://json-schema.org/draft/2020-12/meta/unevaluated",
|
4
|
-
"$vocabulary": {
|
5
|
-
"https://json-schema.org/draft/2020-12/vocab/unevaluated": true
|
6
|
-
},
|
7
4
|
"$dynamicAnchor": "meta",
|
8
5
|
|
9
6
|
"title": "Unevaluated applicator vocabulary meta-schema",
|
@@ -1,9 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
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
4
|
"$dynamicAnchor": "meta",
|
8
5
|
|
9
6
|
"title": "Validation vocabulary meta-schema",
|
@@ -36,11 +36,11 @@ module JSONSkooma
|
|
36
36
|
Keywords::Draft201909::Items,
|
37
37
|
Keywords::Draft201909::AdditionalItems,
|
38
38
|
Keywords::Draft201909::UnevaluatedItems,
|
39
|
+
Keywords::Draft201909::UnevaluatedProperties,
|
39
40
|
Keywords::Applicator::Contains,
|
40
41
|
Keywords::Applicator::Properties,
|
41
42
|
Keywords::Applicator::PatternProperties,
|
42
43
|
Keywords::Applicator::AdditionalProperties,
|
43
|
-
Keywords::Unevaluated::UnevaluatedProperties,
|
44
44
|
Keywords::Applicator::PropertyNames
|
45
45
|
)
|
46
46
|
|
@@ -27,7 +27,7 @@ module JSONSkooma
|
|
27
27
|
metaschema_uri: parent_schema.metaschema_uri,
|
28
28
|
cache_id: parent_schema.cache_id
|
29
29
|
)
|
30
|
-
dynamic_anchor = @ref_schema["$dynamicAnchor"]
|
30
|
+
dynamic_anchor = @ref_schema["$dynamicAnchor"] if @ref_schema.type == "object"
|
31
31
|
@dynamic = dynamic_anchor == @fragment
|
32
32
|
end
|
33
33
|
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JSONSkooma
|
4
|
+
module Keywords
|
5
|
+
module Draft201909
|
6
|
+
class UnevaluatedProperties < Base
|
7
|
+
self.key = "unevaluatedProperties"
|
8
|
+
self.instance_types = %w[object]
|
9
|
+
self.value_schema = :schema
|
10
|
+
self.depends_on = %w[
|
11
|
+
properties patternProperties additionalProperties
|
12
|
+
if then else dependentSchemas allOf anyOf oneOf not
|
13
|
+
$ref $dynamicRef $recursiveRef
|
14
|
+
]
|
15
|
+
|
16
|
+
LOOKUP_KEYWORDS = %w[properties patternProperties additionalProperties unevaluatedProperties].freeze
|
17
|
+
|
18
|
+
def evaluate(instance, result)
|
19
|
+
evaluated_names = Set.new
|
20
|
+
result.parent.collect_annotations(instance, keys: LOOKUP_KEYWORDS) do |node|
|
21
|
+
evaluated_names += node.annotation
|
22
|
+
end
|
23
|
+
|
24
|
+
annotation = []
|
25
|
+
error = []
|
26
|
+
instance.each do |name, item|
|
27
|
+
next if evaluated_names.include?(name)
|
28
|
+
|
29
|
+
if json.evaluate(item, result).passed?
|
30
|
+
annotation << name
|
31
|
+
else
|
32
|
+
error << name
|
33
|
+
# reset to success for the next iteration
|
34
|
+
result.success
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
return result.failure(error) if error.any?
|
39
|
+
|
40
|
+
result.annotate(annotation)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -10,6 +10,7 @@ module JSONSkooma
|
|
10
10
|
self.depends_on = %w[
|
11
11
|
properties patternProperties additionalProperties
|
12
12
|
if then else dependentSchemas allOf anyOf oneOf not
|
13
|
+
$ref $dynamicRef
|
13
14
|
]
|
14
15
|
|
15
16
|
LOOKUP_KEYWORDS = %w[properties patternProperties additionalProperties unevaluatedProperties].freeze
|
@@ -6,7 +6,8 @@ module JSONSkooma
|
|
6
6
|
module Validators
|
7
7
|
class IdnHostname < Base
|
8
8
|
def call(data)
|
9
|
-
|
9
|
+
register_opts = data.value.ascii_only? ? {alabel: data.value} : {ulabel: data.value}
|
10
|
+
URI::IDNA.register(**register_opts)
|
10
11
|
rescue URI::IDNA::Error => e
|
11
12
|
raise FormatError, "#{data} is not a valid IDN hostname: #{e.message}"
|
12
13
|
end
|
data/lib/json_skooma/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Svyatoslav Kryukov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zeitwerk
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.2'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0.
|
68
|
+
version: '0.2'
|
69
69
|
description: I bring some sugar for your JSONs.
|
70
70
|
email:
|
71
71
|
- me@skryukov.dev
|
@@ -152,6 +152,7 @@ files:
|
|
152
152
|
- lib/json_skooma/keywords/draft_2019_09/recursive_anchor.rb
|
153
153
|
- lib/json_skooma/keywords/draft_2019_09/recursive_ref.rb
|
154
154
|
- lib/json_skooma/keywords/draft_2019_09/unevaluated_items.rb
|
155
|
+
- lib/json_skooma/keywords/draft_2019_09/unevaluated_properties.rb
|
155
156
|
- lib/json_skooma/keywords/format_annotation/format.rb
|
156
157
|
- lib/json_skooma/keywords/meta_data/default.rb
|
157
158
|
- lib/json_skooma/keywords/meta_data/deprecated.rb
|