json_skooma 0.2.0 → 0.2.1
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 +9 -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/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/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/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: 9da78d5df937e93b851e37daf72770aeb62c61a09922232a2dc308533a4c5e36
|
|
4
|
+
data.tar.gz: 13759edb9c18994d8f315f740b37a5e32c4935415c0262292f77f6f52e648a30
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b5b8b57d54a71b2c75f85c4f4964757cce15acedbbc49d967ebcea2447a17dfd0acbd36441aafb647f4e744ae91b78e84917ff0a7964b584a157602797210655
|
|
7
|
+
data.tar.gz: 8435cc06b0e079f1980797b0b2cbf3a7d635bb78bcbab8431f7c4408b54e871ee2dd79bd37bf948653f5d9c1f87626618135894e54fef24135e162aca046f7e3
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning].
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.2.1] - 2023-12-03
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Make `unevaluated*` keyword respect reference keywords. ([@skryukov])
|
|
15
|
+
- Fix `:basic` output. ([@skryukov])
|
|
16
|
+
|
|
10
17
|
## [0.2.0] - 2023-10-23
|
|
11
18
|
|
|
12
19
|
### Added
|
|
@@ -30,7 +37,8 @@ and this project adheres to [Semantic Versioning].
|
|
|
30
37
|
|
|
31
38
|
[@skryukov]: https://github.com/skryukov
|
|
32
39
|
|
|
33
|
-
[Unreleased]: https://github.com/skryukov/json_skooma/compare/v0.2.
|
|
40
|
+
[Unreleased]: https://github.com/skryukov/json_skooma/compare/v0.2.1...HEAD
|
|
41
|
+
[0.2.1]: https://github.com/skryukov/json_skooma/compare/v0.2.0...v0.2.1
|
|
34
42
|
[0.2.0]: https://github.com/skryukov/json_skooma/compare/v0.1.0...v0.2.0
|
|
35
43
|
[0.1.0]: https://github.com/skryukov/json_skooma/commits/v0.1.0
|
|
36
44
|
|
|
@@ -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",
|
|
@@ -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
|
|
|
@@ -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.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Svyatoslav Kryukov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-12-03 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
|