jsi-dev 0.0.0.pre.kramdown
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +8 -0
- data/CHANGELOG.md +101 -0
- data/LICENSE.md +613 -0
- data/README.md +303 -0
- data/docs/glossary.md +281 -0
- data/jsi.gemspec +30 -0
- data/lib/jsi/base/node.rb +373 -0
- data/lib/jsi/base.rb +738 -0
- data/lib/jsi/jsi_coder.rb +92 -0
- data/lib/jsi/metaschema.rb +6 -0
- data/lib/jsi/metaschema_node/bootstrap_schema.rb +126 -0
- data/lib/jsi/metaschema_node.rb +262 -0
- data/lib/jsi/ptr.rb +314 -0
- data/lib/jsi/schema/application/child_application/contains.rb +25 -0
- data/lib/jsi/schema/application/child_application/draft04.rb +21 -0
- data/lib/jsi/schema/application/child_application/draft06.rb +28 -0
- data/lib/jsi/schema/application/child_application/draft07.rb +28 -0
- data/lib/jsi/schema/application/child_application/items.rb +18 -0
- data/lib/jsi/schema/application/child_application/properties.rb +25 -0
- data/lib/jsi/schema/application/child_application.rb +13 -0
- data/lib/jsi/schema/application/draft04.rb +8 -0
- data/lib/jsi/schema/application/draft06.rb +8 -0
- data/lib/jsi/schema/application/draft07.rb +8 -0
- data/lib/jsi/schema/application/inplace_application/dependencies.rb +28 -0
- data/lib/jsi/schema/application/inplace_application/draft04.rb +25 -0
- data/lib/jsi/schema/application/inplace_application/draft06.rb +26 -0
- data/lib/jsi/schema/application/inplace_application/draft07.rb +32 -0
- data/lib/jsi/schema/application/inplace_application/ifthenelse.rb +20 -0
- data/lib/jsi/schema/application/inplace_application/ref.rb +18 -0
- data/lib/jsi/schema/application/inplace_application/someof.rb +44 -0
- data/lib/jsi/schema/application/inplace_application.rb +14 -0
- data/lib/jsi/schema/application.rb +12 -0
- data/lib/jsi/schema/draft04.rb +13 -0
- data/lib/jsi/schema/draft06.rb +13 -0
- data/lib/jsi/schema/draft07.rb +13 -0
- data/lib/jsi/schema/issue.rb +36 -0
- data/lib/jsi/schema/ref.rb +183 -0
- data/lib/jsi/schema/schema_ancestor_node.rb +122 -0
- data/lib/jsi/schema/validation/array.rb +69 -0
- data/lib/jsi/schema/validation/const.rb +20 -0
- data/lib/jsi/schema/validation/contains.rb +25 -0
- data/lib/jsi/schema/validation/dependencies.rb +49 -0
- data/lib/jsi/schema/validation/draft04/minmax.rb +91 -0
- data/lib/jsi/schema/validation/draft04.rb +110 -0
- data/lib/jsi/schema/validation/draft06.rb +120 -0
- data/lib/jsi/schema/validation/draft07.rb +157 -0
- data/lib/jsi/schema/validation/enum.rb +25 -0
- data/lib/jsi/schema/validation/ifthenelse.rb +46 -0
- data/lib/jsi/schema/validation/items.rb +54 -0
- data/lib/jsi/schema/validation/not.rb +20 -0
- data/lib/jsi/schema/validation/numeric.rb +121 -0
- data/lib/jsi/schema/validation/object.rb +45 -0
- data/lib/jsi/schema/validation/pattern.rb +34 -0
- data/lib/jsi/schema/validation/properties.rb +101 -0
- data/lib/jsi/schema/validation/property_names.rb +32 -0
- data/lib/jsi/schema/validation/ref.rb +40 -0
- data/lib/jsi/schema/validation/required.rb +27 -0
- data/lib/jsi/schema/validation/someof.rb +90 -0
- data/lib/jsi/schema/validation/string.rb +47 -0
- data/lib/jsi/schema/validation/type.rb +49 -0
- data/lib/jsi/schema/validation.rb +49 -0
- data/lib/jsi/schema.rb +792 -0
- data/lib/jsi/schema_classes.rb +357 -0
- data/lib/jsi/schema_registry.rb +190 -0
- data/lib/jsi/schema_set.rb +219 -0
- data/lib/jsi/simple_wrap.rb +26 -0
- data/lib/jsi/util/private/attr_struct.rb +130 -0
- data/lib/jsi/util/private/memo_map.rb +75 -0
- data/lib/jsi/util/private.rb +202 -0
- data/lib/jsi/util/typelike.rb +225 -0
- data/lib/jsi/util.rb +227 -0
- data/lib/jsi/validation/error.rb +34 -0
- data/lib/jsi/validation/result.rb +212 -0
- data/lib/jsi/validation.rb +15 -0
- data/lib/jsi/version.rb +5 -0
- data/lib/jsi.rb +105 -0
- data/lib/schemas/json-schema.org/draft-04/schema.rb +169 -0
- data/lib/schemas/json-schema.org/draft-06/schema.rb +171 -0
- data/lib/schemas/json-schema.org/draft-07/schema.rb +198 -0
- data/readme.rb +138 -0
- data/{resources}/schemas/json-schema.org/draft-04/schema.json +149 -0
- data/{resources}/schemas/json-schema.org/draft-06/schema.json +154 -0
- data/{resources}/schemas/json-schema.org/draft-07/schema.json +168 -0
- metadata +155 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JSI
|
4
|
+
module Validation
|
5
|
+
autoload :Error, 'jsi/validation/error'
|
6
|
+
|
7
|
+
autoload :Result, 'jsi/validation/result'
|
8
|
+
autoload :FullResult, 'jsi/validation/result'
|
9
|
+
autoload :ValidityResult, 'jsi/validation/result'
|
10
|
+
|
11
|
+
VALID = ValidityResult.new(true).freeze
|
12
|
+
|
13
|
+
INVALID = ValidityResult.new(false).freeze
|
14
|
+
end
|
15
|
+
end
|
data/lib/jsi/version.rb
ADDED
data/lib/jsi.rb
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "jsi/version"
|
4
|
+
require "pp"
|
5
|
+
require "set"
|
6
|
+
require "json"
|
7
|
+
require "pathname"
|
8
|
+
require "bigdecimal"
|
9
|
+
require "addressable/uri"
|
10
|
+
|
11
|
+
module JSI
|
12
|
+
# generally put in code paths that are not expected to be valid control flow paths.
|
13
|
+
# rather a NotImplementedCorrectlyError. but that's too long.
|
14
|
+
#
|
15
|
+
# if you've found this class because JSI has raised this error, please open an issue with the backtrace
|
16
|
+
# and any context you can provide at https://github.com/notEthan/jsi/issues
|
17
|
+
class Bug < NotImplementedError
|
18
|
+
end
|
19
|
+
|
20
|
+
# @private TODO remove, any ruby without this is already long EOL
|
21
|
+
FrozenError = Object.const_defined?(:FrozenError) ? ::FrozenError : Class.new(StandardError)
|
22
|
+
|
23
|
+
# @private
|
24
|
+
ROOT_PATH = Pathname.new(__FILE__).dirname.parent.expand_path
|
25
|
+
|
26
|
+
# @private
|
27
|
+
RESOURCES_PATH = ROOT_PATH.join('{resources}')
|
28
|
+
|
29
|
+
# @private
|
30
|
+
SCHEMAS_PATH = RESOURCES_PATH.join('schemas')
|
31
|
+
|
32
|
+
autoload :Util, 'jsi/util'
|
33
|
+
autoload :Ptr, 'jsi/ptr'
|
34
|
+
autoload :Schema, 'jsi/schema'
|
35
|
+
autoload :SchemaSet, 'jsi/schema_set'
|
36
|
+
autoload :Base, 'jsi/base'
|
37
|
+
autoload :Metaschema, 'jsi/metaschema'
|
38
|
+
autoload :MetaschemaNode, 'jsi/metaschema_node'
|
39
|
+
autoload :SchemaModule, 'jsi/schema_classes'
|
40
|
+
autoload :SchemaClasses, 'jsi/schema_classes'
|
41
|
+
autoload :SchemaRegistry, 'jsi/schema_registry'
|
42
|
+
autoload :Validation, 'jsi/validation'
|
43
|
+
autoload :JSICoder, 'jsi/jsi_coder'
|
44
|
+
|
45
|
+
autoload :JSONSchemaDraft04, 'schemas/json-schema.org/draft-04/schema'
|
46
|
+
autoload :JSONSchemaDraft06, 'schemas/json-schema.org/draft-06/schema'
|
47
|
+
autoload :JSONSchemaDraft07, 'schemas/json-schema.org/draft-07/schema'
|
48
|
+
autoload :JSONSchemaOrgDraft04, 'schemas/json-schema.org/draft-04/schema'
|
49
|
+
autoload :JSONSchemaOrgDraft06, 'schemas/json-schema.org/draft-06/schema'
|
50
|
+
autoload :JSONSchemaOrgDraft07, 'schemas/json-schema.org/draft-07/schema'
|
51
|
+
|
52
|
+
autoload :SimpleWrap, 'jsi/simple_wrap'
|
53
|
+
|
54
|
+
# Instantiates the given schema content as a JSI Schema, passing all params to
|
55
|
+
# {JSI.new_schema}, and returns its {Schema#jsi_schema_module JSI Schema Module}.
|
56
|
+
#
|
57
|
+
# @return (see JSI::Schema::DescribesSchema#new_schema_module)
|
58
|
+
def self.new_schema_module(schema_content, **kw, &block)
|
59
|
+
new_schema(schema_content, **kw, &block).jsi_schema_module
|
60
|
+
end
|
61
|
+
|
62
|
+
# Instantiates the given document as a JSI Metaschema.
|
63
|
+
#
|
64
|
+
# @param metaschema_document an object to be instantiated as a JSI Metaschema
|
65
|
+
# @param schema_implementation_modules (see MetaschemaNode#initialize)
|
66
|
+
# @return [JSI::MetaschemaNode + JSI::DescribesSchema + JSI::Schema]
|
67
|
+
def self.new_metaschema(metaschema_document,
|
68
|
+
schema_implementation_modules:
|
69
|
+
)
|
70
|
+
MetaschemaNode.new(metaschema_document,
|
71
|
+
schema_implementation_modules: schema_implementation_modules,
|
72
|
+
)
|
73
|
+
end
|
74
|
+
|
75
|
+
# Instantiates the given document as a JSI Metaschema, passing all params to
|
76
|
+
# {new_metaschema}, and returns its {Schema#jsi_schema_module JSI Schema Module}.
|
77
|
+
#
|
78
|
+
# @return [Module + JSI::SchemaModule::DescribesSchemaModule + JSI::SchemaModule]
|
79
|
+
def self.new_metaschema_module(metaschema_document, **kw)
|
80
|
+
new_metaschema(metaschema_document, **kw).jsi_schema_module
|
81
|
+
end
|
82
|
+
|
83
|
+
# `JSI.schema_registry` is the default {JSI::SchemaRegistry} in which schemas are registered and from
|
84
|
+
# which they resolve references.
|
85
|
+
#
|
86
|
+
# @return [JSI::SchemaRegistry]
|
87
|
+
def self.schema_registry
|
88
|
+
@schema_registry
|
89
|
+
end
|
90
|
+
|
91
|
+
# @param schema_registry [JSI::SchemaRegistry]
|
92
|
+
def self.schema_registry=(schema_registry)
|
93
|
+
@schema_registry = schema_registry
|
94
|
+
end
|
95
|
+
|
96
|
+
DEFAULT_SCHEMA_REGISTRY = SchemaRegistry.new.tap do |schema_registry|
|
97
|
+
schema_registry.autoload_uri("http://json-schema.org/draft-04/schema") { JSI::JSONSchemaDraft04.schema }
|
98
|
+
schema_registry.autoload_uri("http://json-schema.org/draft-06/schema") { JSI::JSONSchemaDraft06.schema }
|
99
|
+
schema_registry.autoload_uri("http://json-schema.org/draft-07/schema") { JSI::JSONSchemaDraft07.schema }
|
100
|
+
end.freeze
|
101
|
+
|
102
|
+
self.schema_registry = DEFAULT_SCHEMA_REGISTRY.dup
|
103
|
+
|
104
|
+
Schema # trigger autoload, ensure JSI methods (new_schema etc) defined in schema.rb load
|
105
|
+
end
|
@@ -0,0 +1,169 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JSI
|
4
|
+
metaschema_document = ::JSON.parse(SCHEMAS_PATH.join('json-schema.org/draft-04/schema.json').read)
|
5
|
+
JSONSchemaDraft04 = JSI.new_metaschema_module(metaschema_document,
|
6
|
+
schema_implementation_modules: [JSI::Schema::Draft04],
|
7
|
+
)
|
8
|
+
|
9
|
+
# in draft 4, boolean schemas are not described in the root, but on anyOf schemas on
|
10
|
+
# properties/additionalProperties and properties/additionalItems.
|
11
|
+
# these still describe schemas, despite not being described by the metaschema.
|
12
|
+
also_describe_schemas =
|
13
|
+
JSONSchemaDraft04.schema["properties"]["additionalProperties"]["anyOf"] +
|
14
|
+
JSONSchemaDraft04.schema["properties"]["additionalItems"]["anyOf"]
|
15
|
+
also_describe_schemas.each do |schema|
|
16
|
+
schema.describes_schema!([JSI::Schema::Draft04])
|
17
|
+
end
|
18
|
+
|
19
|
+
# the JSI schema module for `http://json-schema.org/draft-04/schema`
|
20
|
+
module JSONSchemaDraft04
|
21
|
+
# @!parse extend JSI::SchemaModule::DescribesSchemaModule
|
22
|
+
# @!parse include JSI::Schema::Draft04
|
23
|
+
|
24
|
+
|
25
|
+
Id = properties['id']
|
26
|
+
Xschema = properties['$schema']
|
27
|
+
Title = properties['title']
|
28
|
+
Description = properties['description']
|
29
|
+
Default = properties['default']
|
30
|
+
MultipleOf = properties['multipleOf']
|
31
|
+
Maximum = properties['maximum']
|
32
|
+
ExclusiveMaximum = properties['exclusiveMaximum']
|
33
|
+
Minimum = properties['minimum']
|
34
|
+
ExclusiveMinimum = properties['exclusiveMinimum']
|
35
|
+
MaxLength = properties['maxLength']
|
36
|
+
MinLength = properties['minLength']
|
37
|
+
Pattern = properties['pattern']
|
38
|
+
AdditionalItems = properties['additionalItems']
|
39
|
+
Items = properties['items']
|
40
|
+
MaxItems = properties['maxItems']
|
41
|
+
MinItems = properties['minItems']
|
42
|
+
UniqueItems = properties['uniqueItems']
|
43
|
+
MaxProperties = properties['maxProperties']
|
44
|
+
MinProperties = properties['minProperties']
|
45
|
+
Required = properties['required']
|
46
|
+
AdditionalProperties = properties['additionalProperties']
|
47
|
+
Definitions = properties['definitions']
|
48
|
+
Properties = properties['properties']
|
49
|
+
PatternProperties = properties['patternProperties']
|
50
|
+
Dependencies = properties['dependencies']
|
51
|
+
Enum = properties['enum']
|
52
|
+
Type = properties['type']
|
53
|
+
Format = properties['format']
|
54
|
+
AllOf = properties['allOf']
|
55
|
+
AnyOf = properties['anyOf']
|
56
|
+
OneOf = properties['oneOf']
|
57
|
+
Not = properties['not']
|
58
|
+
|
59
|
+
SchemaArray = definitions['schemaArray']
|
60
|
+
PositiveInteger = definitions['positiveInteger']
|
61
|
+
PositiveIntegerDefault0 = definitions['positiveIntegerDefault0']
|
62
|
+
SimpleType = definitions['simpleTypes']
|
63
|
+
StringArray = definitions['stringArray']
|
64
|
+
|
65
|
+
module Id
|
66
|
+
end
|
67
|
+
module Xschema
|
68
|
+
end
|
69
|
+
module Title
|
70
|
+
end
|
71
|
+
module Description
|
72
|
+
end
|
73
|
+
module Default
|
74
|
+
end
|
75
|
+
module MultipleOf
|
76
|
+
end
|
77
|
+
module Maximum
|
78
|
+
end
|
79
|
+
module ExclusiveMaximum
|
80
|
+
end
|
81
|
+
module Minimum
|
82
|
+
end
|
83
|
+
module ExclusiveMinimum
|
84
|
+
end
|
85
|
+
module MaxLength
|
86
|
+
end
|
87
|
+
module MinLength
|
88
|
+
end
|
89
|
+
module Pattern
|
90
|
+
end
|
91
|
+
module AdditionalItems
|
92
|
+
end
|
93
|
+
module Items
|
94
|
+
end
|
95
|
+
module MaxItems
|
96
|
+
end
|
97
|
+
module MinItems
|
98
|
+
end
|
99
|
+
module UniqueItems
|
100
|
+
end
|
101
|
+
module MaxProperties
|
102
|
+
end
|
103
|
+
module MinProperties
|
104
|
+
end
|
105
|
+
module Required
|
106
|
+
end
|
107
|
+
module AdditionalProperties
|
108
|
+
end
|
109
|
+
module Definitions
|
110
|
+
end
|
111
|
+
module Properties
|
112
|
+
end
|
113
|
+
module PatternProperties
|
114
|
+
end
|
115
|
+
module Dependencies
|
116
|
+
end
|
117
|
+
module Enum
|
118
|
+
end
|
119
|
+
module Type
|
120
|
+
end
|
121
|
+
module Format
|
122
|
+
end
|
123
|
+
module AllOf
|
124
|
+
end
|
125
|
+
module AnyOf
|
126
|
+
end
|
127
|
+
module OneOf
|
128
|
+
end
|
129
|
+
module Not
|
130
|
+
end
|
131
|
+
|
132
|
+
module SchemaArray
|
133
|
+
end
|
134
|
+
module PositiveInteger
|
135
|
+
end
|
136
|
+
module PositiveIntegerDefault0
|
137
|
+
end
|
138
|
+
module SimpleType
|
139
|
+
end
|
140
|
+
module StringArray
|
141
|
+
end
|
142
|
+
|
143
|
+
AdditionalItems::Boolean = AdditionalItems.anyOf[0]
|
144
|
+
AdditionalProperties::Boolean = AdditionalProperties.anyOf[0]
|
145
|
+
Dependencies::Dependency = Dependencies.additionalProperties
|
146
|
+
Type::Array = Type.anyOf[1]
|
147
|
+
PositiveIntegerDefault0::Default0 = PositiveIntegerDefault0.allOf[1]
|
148
|
+
StringItem = StringArray.items
|
149
|
+
|
150
|
+
module AdditionalItems::Boolean
|
151
|
+
end
|
152
|
+
module AdditionalProperties::Boolean
|
153
|
+
end
|
154
|
+
module Dependencies::Dependency
|
155
|
+
end
|
156
|
+
module Type::Array
|
157
|
+
end
|
158
|
+
module PositiveIntegerDefault0::Default0
|
159
|
+
end
|
160
|
+
module StringItem
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
JSONSchemaOrgDraft04 = JSONSchemaDraft04
|
165
|
+
|
166
|
+
# @deprecated after v0.7.0, alias of {JSONSchemaDraft04}
|
167
|
+
module JSONSchemaOrgDraft04
|
168
|
+
end
|
169
|
+
end
|
@@ -0,0 +1,171 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JSI
|
4
|
+
metaschema_document = ::JSON.parse(SCHEMAS_PATH.join('json-schema.org/draft-06/schema.json').read)
|
5
|
+
JSONSchemaDraft06 = JSI.new_metaschema_module(metaschema_document,
|
6
|
+
schema_implementation_modules: [JSI::Schema::Draft06],
|
7
|
+
)
|
8
|
+
|
9
|
+
# the JSI schema module for `http://json-schema.org/draft-06/schema`
|
10
|
+
module JSONSchemaDraft06
|
11
|
+
# @!parse extend JSI::SchemaModule::DescribesSchemaModule
|
12
|
+
# @!parse include JSI::Schema::Draft06
|
13
|
+
|
14
|
+
|
15
|
+
Id = properties['$id']
|
16
|
+
Xschema = properties['$schema']
|
17
|
+
Ref = properties['$ref']
|
18
|
+
Title = properties['title']
|
19
|
+
Description = properties['description']
|
20
|
+
Default = properties['default']
|
21
|
+
Examples = properties['examples']
|
22
|
+
MultipleOf = properties['multipleOf']
|
23
|
+
Maximum = properties['maximum']
|
24
|
+
ExclusiveMaximum = properties['exclusiveMaximum']
|
25
|
+
Minimum = properties['minimum']
|
26
|
+
ExclusiveMinimum = properties['exclusiveMinimum']
|
27
|
+
MaxLength = properties['maxLength']
|
28
|
+
MinLength = properties['minLength']
|
29
|
+
Pattern = properties['pattern']
|
30
|
+
AdditionalItems = properties['additionalItems']
|
31
|
+
Items = properties['items']
|
32
|
+
MaxItems = properties['maxItems']
|
33
|
+
MinItems = properties['minItems']
|
34
|
+
UniqueItems = properties['uniqueItems']
|
35
|
+
Contains = properties['contains']
|
36
|
+
MaxProperties = properties['maxProperties']
|
37
|
+
MinProperties = properties['minProperties']
|
38
|
+
Required = properties['required']
|
39
|
+
AdditionalProperties = properties['additionalProperties']
|
40
|
+
Definitions = properties['definitions']
|
41
|
+
Properties = properties['properties']
|
42
|
+
PatternProperties = properties['patternProperties']
|
43
|
+
Dependencies = properties['dependencies']
|
44
|
+
PropertyNames = properties['propertyNames']
|
45
|
+
Const = properties['const']
|
46
|
+
Enum = properties['enum']
|
47
|
+
Type = properties['type']
|
48
|
+
Format = properties['format']
|
49
|
+
AllOf = properties['allOf']
|
50
|
+
AnyOf = properties['anyOf']
|
51
|
+
OneOf = properties['oneOf']
|
52
|
+
Not = properties['not']
|
53
|
+
|
54
|
+
SchemaArray = definitions['schemaArray']
|
55
|
+
NonNegativeInteger = definitions['nonNegativeInteger']
|
56
|
+
NonNegativeIntegerDefault0 = definitions['nonNegativeIntegerDefault0']
|
57
|
+
SimpleType = definitions['simpleTypes']
|
58
|
+
StringArray = definitions['stringArray']
|
59
|
+
|
60
|
+
module Id
|
61
|
+
end
|
62
|
+
module Xschema
|
63
|
+
end
|
64
|
+
module Ref
|
65
|
+
end
|
66
|
+
module Title
|
67
|
+
end
|
68
|
+
module Description
|
69
|
+
end
|
70
|
+
module Default
|
71
|
+
end
|
72
|
+
module Examples
|
73
|
+
end
|
74
|
+
module MultipleOf
|
75
|
+
end
|
76
|
+
module Maximum
|
77
|
+
end
|
78
|
+
module ExclusiveMaximum
|
79
|
+
end
|
80
|
+
module Minimum
|
81
|
+
end
|
82
|
+
module ExclusiveMinimum
|
83
|
+
end
|
84
|
+
module MaxLength
|
85
|
+
end
|
86
|
+
module MinLength
|
87
|
+
end
|
88
|
+
module Pattern
|
89
|
+
end
|
90
|
+
module AdditionalItems
|
91
|
+
end
|
92
|
+
module Items
|
93
|
+
end
|
94
|
+
module MaxItems
|
95
|
+
end
|
96
|
+
module MinItems
|
97
|
+
end
|
98
|
+
module UniqueItems
|
99
|
+
end
|
100
|
+
module Contains
|
101
|
+
end
|
102
|
+
module MaxProperties
|
103
|
+
end
|
104
|
+
module MinProperties
|
105
|
+
end
|
106
|
+
module Required
|
107
|
+
end
|
108
|
+
module AdditionalProperties
|
109
|
+
end
|
110
|
+
module Definitions
|
111
|
+
end
|
112
|
+
module Properties
|
113
|
+
end
|
114
|
+
module PatternProperties
|
115
|
+
end
|
116
|
+
module Dependencies
|
117
|
+
end
|
118
|
+
module PropertyNames
|
119
|
+
end
|
120
|
+
module Const
|
121
|
+
end
|
122
|
+
module Enum
|
123
|
+
end
|
124
|
+
module Type
|
125
|
+
end
|
126
|
+
module Format
|
127
|
+
end
|
128
|
+
module AllOf
|
129
|
+
end
|
130
|
+
module AnyOf
|
131
|
+
end
|
132
|
+
module OneOf
|
133
|
+
end
|
134
|
+
module Not
|
135
|
+
end
|
136
|
+
|
137
|
+
module SchemaArray
|
138
|
+
end
|
139
|
+
module NonNegativeInteger
|
140
|
+
end
|
141
|
+
module NonNegativeIntegerDefault0
|
142
|
+
end
|
143
|
+
module SimpleType
|
144
|
+
end
|
145
|
+
module StringArray
|
146
|
+
end
|
147
|
+
|
148
|
+
Example = Examples.items
|
149
|
+
Dependencies::Dependency = Dependencies.additionalProperties
|
150
|
+
Type::Array = Type.anyOf[1]
|
151
|
+
NonNegativeIntegerDefault0::Default0 = NonNegativeIntegerDefault0.allOf[1]
|
152
|
+
StringItem = StringArray.items
|
153
|
+
|
154
|
+
module Example
|
155
|
+
end
|
156
|
+
module Dependencies::Dependency
|
157
|
+
end
|
158
|
+
module Type::Array
|
159
|
+
end
|
160
|
+
module NonNegativeIntegerDefault0::Default0
|
161
|
+
end
|
162
|
+
module StringItem
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
JSONSchemaOrgDraft06 = JSONSchemaDraft06
|
167
|
+
|
168
|
+
# @deprecated after v0.7.0, alias of {JSONSchemaDraft06}
|
169
|
+
module JSONSchemaOrgDraft06
|
170
|
+
end
|
171
|
+
end
|
@@ -0,0 +1,198 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JSI
|
4
|
+
metaschema_document = ::JSON.parse(SCHEMAS_PATH.join('json-schema.org/draft-07/schema.json').read)
|
5
|
+
JSONSchemaDraft07 = JSI.new_metaschema_module(metaschema_document,
|
6
|
+
schema_implementation_modules: [JSI::Schema::Draft07],
|
7
|
+
)
|
8
|
+
|
9
|
+
# the JSI schema module for `http://json-schema.org/draft-07/schema`
|
10
|
+
module JSONSchemaDraft07
|
11
|
+
# @!parse extend JSI::SchemaModule::DescribesSchemaModule
|
12
|
+
# @!parse include JSI::Schema::Draft07
|
13
|
+
|
14
|
+
|
15
|
+
Id = properties['$id']
|
16
|
+
Xschema = properties['$schema']
|
17
|
+
Ref = properties['$ref']
|
18
|
+
Comment = properties['$comment']
|
19
|
+
Title = properties['title']
|
20
|
+
Description = properties['description']
|
21
|
+
Default = properties['default']
|
22
|
+
ReadOnly = properties['readOnly']
|
23
|
+
Examples = properties['examples']
|
24
|
+
MultipleOf = properties['multipleOf']
|
25
|
+
Maximum = properties['maximum']
|
26
|
+
ExclusiveMaximum = properties['exclusiveMaximum']
|
27
|
+
Minimum = properties['minimum']
|
28
|
+
ExclusiveMinimum = properties['exclusiveMinimum']
|
29
|
+
MaxLength = properties['maxLength']
|
30
|
+
MinLength = properties['minLength']
|
31
|
+
Pattern = properties['pattern']
|
32
|
+
AdditionalItems = properties['additionalItems']
|
33
|
+
Items = properties['items']
|
34
|
+
MaxItems = properties['maxItems']
|
35
|
+
MinItems = properties['minItems']
|
36
|
+
UniqueItems = properties['uniqueItems']
|
37
|
+
Contains = properties['contains']
|
38
|
+
MaxProperties = properties['maxProperties']
|
39
|
+
MinProperties = properties['minProperties']
|
40
|
+
Required = properties['required']
|
41
|
+
AdditionalProperties = properties['additionalProperties']
|
42
|
+
Definitions = properties['definitions']
|
43
|
+
Properties = properties['properties']
|
44
|
+
PatternProperties = properties['patternProperties']
|
45
|
+
Dependencies = properties['dependencies']
|
46
|
+
PropertyNames = properties['propertyNames']
|
47
|
+
Const = properties['const']
|
48
|
+
Enum = properties['enum']
|
49
|
+
Type = properties['type']
|
50
|
+
Format = properties['format']
|
51
|
+
ContentMediaType = properties['contentMediaType']
|
52
|
+
ContentEncoding = properties['contentEncoding']
|
53
|
+
If = properties['if']
|
54
|
+
Then = properties['then']
|
55
|
+
Else = properties['else']
|
56
|
+
AllOf = properties['allOf']
|
57
|
+
AnyOf = properties['anyOf']
|
58
|
+
OneOf = properties['oneOf']
|
59
|
+
Not = properties['not']
|
60
|
+
|
61
|
+
SchemaArray = definitions['schemaArray']
|
62
|
+
NonNegativeInteger = definitions['nonNegativeInteger']
|
63
|
+
NonNegativeIntegerDefault0 = definitions['nonNegativeIntegerDefault0']
|
64
|
+
SimpleType = definitions['simpleTypes']
|
65
|
+
StringArray = definitions['stringArray']
|
66
|
+
|
67
|
+
module Id
|
68
|
+
end
|
69
|
+
module Xschema
|
70
|
+
end
|
71
|
+
module Ref
|
72
|
+
end
|
73
|
+
module Comment
|
74
|
+
end
|
75
|
+
module Title
|
76
|
+
end
|
77
|
+
module Description
|
78
|
+
end
|
79
|
+
module Default
|
80
|
+
end
|
81
|
+
module ReadOnly
|
82
|
+
end
|
83
|
+
module Examples
|
84
|
+
end
|
85
|
+
module MultipleOf
|
86
|
+
end
|
87
|
+
module Maximum
|
88
|
+
end
|
89
|
+
module ExclusiveMaximum
|
90
|
+
end
|
91
|
+
module Minimum
|
92
|
+
end
|
93
|
+
module ExclusiveMinimum
|
94
|
+
end
|
95
|
+
module MaxLength
|
96
|
+
end
|
97
|
+
module MinLength
|
98
|
+
end
|
99
|
+
module Pattern
|
100
|
+
end
|
101
|
+
module AdditionalItems
|
102
|
+
end
|
103
|
+
module Items
|
104
|
+
end
|
105
|
+
module MaxItems
|
106
|
+
end
|
107
|
+
module MinItems
|
108
|
+
end
|
109
|
+
module UniqueItems
|
110
|
+
end
|
111
|
+
module Contains
|
112
|
+
end
|
113
|
+
module MaxProperties
|
114
|
+
end
|
115
|
+
module MinProperties
|
116
|
+
end
|
117
|
+
module Required
|
118
|
+
end
|
119
|
+
module AdditionalProperties
|
120
|
+
end
|
121
|
+
module Definitions
|
122
|
+
end
|
123
|
+
module Properties
|
124
|
+
end
|
125
|
+
module PatternProperties
|
126
|
+
end
|
127
|
+
module Dependencies
|
128
|
+
end
|
129
|
+
module PropertyNames
|
130
|
+
end
|
131
|
+
module Const
|
132
|
+
end
|
133
|
+
module Enum
|
134
|
+
end
|
135
|
+
module Type
|
136
|
+
end
|
137
|
+
module Format
|
138
|
+
end
|
139
|
+
module ContentMediaType
|
140
|
+
end
|
141
|
+
module ContentEncoding
|
142
|
+
end
|
143
|
+
module If
|
144
|
+
end
|
145
|
+
module Then
|
146
|
+
end
|
147
|
+
module Else
|
148
|
+
end
|
149
|
+
module AllOf
|
150
|
+
end
|
151
|
+
module AnyOf
|
152
|
+
end
|
153
|
+
module OneOf
|
154
|
+
end
|
155
|
+
module Not
|
156
|
+
end
|
157
|
+
|
158
|
+
module SchemaArray
|
159
|
+
end
|
160
|
+
module NonNegativeInteger
|
161
|
+
end
|
162
|
+
module NonNegativeIntegerDefault0
|
163
|
+
end
|
164
|
+
module SimpleType
|
165
|
+
end
|
166
|
+
module StringArray
|
167
|
+
end
|
168
|
+
|
169
|
+
Example = Examples.items
|
170
|
+
PatternPropertyPattern = PatternProperties.propertyNames
|
171
|
+
Dependencies::Dependency = Dependencies.additionalProperties
|
172
|
+
Enum::Item = Enum.items
|
173
|
+
Type::Array = Type.anyOf[1]
|
174
|
+
NonNegativeIntegerDefault0::Default0 = NonNegativeIntegerDefault0.allOf[1]
|
175
|
+
StringItem = StringArray.items
|
176
|
+
|
177
|
+
module Example
|
178
|
+
end
|
179
|
+
module PatternPropertyPattern
|
180
|
+
end
|
181
|
+
module Dependencies::Dependency
|
182
|
+
end
|
183
|
+
module Enum::Item
|
184
|
+
end
|
185
|
+
module Type::Array
|
186
|
+
end
|
187
|
+
module NonNegativeIntegerDefault0::Default0
|
188
|
+
end
|
189
|
+
module StringItem
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
JSONSchemaOrgDraft07 = JSONSchemaDraft07
|
194
|
+
|
195
|
+
# @deprecated after v0.7.0, alias of {JSONSchemaDraft07}
|
196
|
+
module JSONSchemaOrgDraft07
|
197
|
+
end
|
198
|
+
end
|