json_schemer 0.2.18 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +7 -7
  3. data/CHANGELOG.md +102 -0
  4. data/Gemfile.lock +30 -10
  5. data/README.md +402 -6
  6. data/bin/hostname_character_classes +42 -0
  7. data/bin/rake +29 -0
  8. data/exe/json_schemer +62 -0
  9. data/json_schemer.gemspec +9 -12
  10. data/lib/json_schemer/cached_resolver.rb +16 -0
  11. data/lib/json_schemer/configuration.rb +31 -0
  12. data/lib/json_schemer/content.rb +18 -0
  13. data/lib/json_schemer/draft201909/meta.rb +320 -0
  14. data/lib/json_schemer/draft201909/vocab/applicator.rb +104 -0
  15. data/lib/json_schemer/draft201909/vocab/core.rb +45 -0
  16. data/lib/json_schemer/draft201909/vocab.rb +31 -0
  17. data/lib/json_schemer/draft202012/meta.rb +364 -0
  18. data/lib/json_schemer/draft202012/vocab/applicator.rb +382 -0
  19. data/lib/json_schemer/draft202012/vocab/content.rb +52 -0
  20. data/lib/json_schemer/draft202012/vocab/core.rb +160 -0
  21. data/lib/json_schemer/draft202012/vocab/format_annotation.rb +23 -0
  22. data/lib/json_schemer/draft202012/vocab/format_assertion.rb +23 -0
  23. data/lib/json_schemer/draft202012/vocab/meta_data.rb +30 -0
  24. data/lib/json_schemer/draft202012/vocab/unevaluated.rb +104 -0
  25. data/lib/json_schemer/draft202012/vocab/validation.rb +286 -0
  26. data/lib/json_schemer/draft202012/vocab.rb +105 -0
  27. data/lib/json_schemer/draft4/meta.rb +161 -0
  28. data/lib/json_schemer/draft4/vocab/validation.rb +39 -0
  29. data/lib/json_schemer/draft4/vocab.rb +18 -0
  30. data/lib/json_schemer/draft6/meta.rb +172 -0
  31. data/lib/json_schemer/draft6/vocab.rb +16 -0
  32. data/lib/json_schemer/draft7/meta.rb +183 -0
  33. data/lib/json_schemer/draft7/vocab/validation.rb +69 -0
  34. data/lib/json_schemer/draft7/vocab.rb +30 -0
  35. data/lib/json_schemer/ecma_regexp.rb +51 -0
  36. data/lib/json_schemer/errors.rb +1 -0
  37. data/lib/json_schemer/format/duration.rb +23 -0
  38. data/lib/json_schemer/format/email.rb +56 -0
  39. data/lib/json_schemer/format/hostname.rb +58 -0
  40. data/lib/json_schemer/format/json_pointer.rb +18 -0
  41. data/lib/json_schemer/format/uri_template.rb +34 -0
  42. data/lib/json_schemer/format.rb +128 -109
  43. data/lib/json_schemer/keyword.rb +56 -0
  44. data/lib/json_schemer/location.rb +25 -0
  45. data/lib/json_schemer/openapi.rb +38 -0
  46. data/lib/json_schemer/openapi30/document.rb +1672 -0
  47. data/lib/json_schemer/openapi30/meta.rb +32 -0
  48. data/lib/json_schemer/openapi30/vocab/base.rb +18 -0
  49. data/lib/json_schemer/openapi30/vocab.rb +12 -0
  50. data/lib/json_schemer/openapi31/document.rb +1557 -0
  51. data/lib/json_schemer/openapi31/meta.rb +136 -0
  52. data/lib/json_schemer/openapi31/vocab/base.rb +127 -0
  53. data/lib/json_schemer/openapi31/vocab.rb +18 -0
  54. data/lib/json_schemer/output.rb +56 -0
  55. data/lib/json_schemer/result.rb +242 -0
  56. data/lib/json_schemer/schema.rb +424 -0
  57. data/lib/json_schemer/version.rb +1 -1
  58. data/lib/json_schemer.rb +243 -30
  59. metadata +141 -25
  60. data/lib/json_schemer/cached_ref_resolver.rb +0 -14
  61. data/lib/json_schemer/schema/base.rb +0 -658
  62. data/lib/json_schemer/schema/draft4.rb +0 -44
  63. data/lib/json_schemer/schema/draft6.rb +0 -25
  64. data/lib/json_schemer/schema/draft7.rb +0 -32
data/lib/json_schemer.rb CHANGED
@@ -1,41 +1,105 @@
1
1
  # frozen_string_literal: true
2
- require 'base64'
2
+ require 'bigdecimal'
3
3
  require 'ipaddr'
4
4
  require 'json'
5
5
  require 'net/http'
6
6
  require 'pathname'
7
+ require 'set'
7
8
  require 'time'
8
9
  require 'uri'
9
10
 
10
- require 'ecma-re-validator'
11
11
  require 'hana'
12
12
  require 'regexp_parser'
13
- require 'uri_template'
13
+ require 'simpleidn'
14
14
 
15
15
  require 'json_schemer/version'
16
+ require 'json_schemer/format/duration'
17
+ require 'json_schemer/format/hostname'
18
+ require 'json_schemer/format/json_pointer'
19
+ require 'json_schemer/format/uri_template'
20
+ require 'json_schemer/format/email'
16
21
  require 'json_schemer/format'
22
+ require 'json_schemer/content'
17
23
  require 'json_schemer/errors'
18
- require 'json_schemer/cached_ref_resolver'
19
- require 'json_schemer/schema/base'
20
- require 'json_schemer/schema/draft4'
21
- require 'json_schemer/schema/draft6'
22
- require 'json_schemer/schema/draft7'
24
+ require 'json_schemer/cached_resolver'
25
+ require 'json_schemer/ecma_regexp'
26
+ require 'json_schemer/location'
27
+ require 'json_schemer/result'
28
+ require 'json_schemer/output'
29
+ require 'json_schemer/keyword'
30
+ require 'json_schemer/draft202012/meta'
31
+ require 'json_schemer/draft202012/vocab/core'
32
+ require 'json_schemer/draft202012/vocab/applicator'
33
+ require 'json_schemer/draft202012/vocab/unevaluated'
34
+ require 'json_schemer/draft202012/vocab/validation'
35
+ require 'json_schemer/draft202012/vocab/format_annotation'
36
+ require 'json_schemer/draft202012/vocab/format_assertion'
37
+ require 'json_schemer/draft202012/vocab/content'
38
+ require 'json_schemer/draft202012/vocab/meta_data'
39
+ require 'json_schemer/draft202012/vocab'
40
+ require 'json_schemer/draft201909/meta'
41
+ require 'json_schemer/draft201909/vocab/core'
42
+ require 'json_schemer/draft201909/vocab/applicator'
43
+ require 'json_schemer/draft201909/vocab'
44
+ require 'json_schemer/draft7/meta'
45
+ require 'json_schemer/draft7/vocab/validation'
46
+ require 'json_schemer/draft7/vocab'
47
+ require 'json_schemer/draft6/meta'
48
+ require 'json_schemer/draft6/vocab'
49
+ require 'json_schemer/draft4/meta'
50
+ require 'json_schemer/draft4/vocab/validation'
51
+ require 'json_schemer/draft4/vocab'
52
+ require 'json_schemer/openapi31/meta'
53
+ require 'json_schemer/openapi31/vocab/base'
54
+ require 'json_schemer/openapi31/vocab'
55
+ require 'json_schemer/openapi31/document'
56
+ require 'json_schemer/openapi30/document'
57
+ require 'json_schemer/openapi30/meta'
58
+ require 'json_schemer/openapi30/vocab/base'
59
+ require 'json_schemer/openapi30/vocab'
60
+ require 'json_schemer/openapi'
61
+ require 'json_schemer/configuration'
62
+ require 'json_schemer/schema'
23
63
 
24
64
  module JSONSchemer
25
- class UnsupportedMetaSchema < StandardError; end
65
+ class UnsupportedOpenAPIVersion < StandardError; end
26
66
  class UnknownRef < StandardError; end
67
+ class UnknownFormat < StandardError; end
68
+ class UnknownVocabulary < StandardError; end
69
+ class UnknownContentEncoding < StandardError; end
70
+ class UnknownContentMediaType < StandardError; end
71
+ class UnknownOutputFormat < StandardError; end
27
72
  class InvalidRefResolution < StandardError; end
73
+ class InvalidRefPointer < StandardError; end
74
+ class InvalidRegexpResolution < StandardError; end
28
75
  class InvalidFileURI < StandardError; end
29
- class InvalidSymbolKey < StandardError; end
76
+ class InvalidEcmaRegexp < StandardError; end
30
77
 
31
- DRAFT_CLASS_BY_META_SCHEMA = {
32
- 'http://json-schema.org/schema#' => Schema::Draft4, # Version-less $schema deprecated after Draft 4
33
- 'http://json-schema.org/draft-04/schema#' => Schema::Draft4,
34
- 'http://json-schema.org/draft-06/schema#' => Schema::Draft6,
35
- 'http://json-schema.org/draft-07/schema#' => Schema::Draft7
36
- }.freeze
78
+ VOCABULARIES = {
79
+ 'https://json-schema.org/draft/2020-12/vocab/core' => Draft202012::Vocab::CORE,
80
+ 'https://json-schema.org/draft/2020-12/vocab/applicator' => Draft202012::Vocab::APPLICATOR,
81
+ 'https://json-schema.org/draft/2020-12/vocab/unevaluated' => Draft202012::Vocab::UNEVALUATED,
82
+ 'https://json-schema.org/draft/2020-12/vocab/validation' => Draft202012::Vocab::VALIDATION,
83
+ 'https://json-schema.org/draft/2020-12/vocab/format-annotation' => Draft202012::Vocab::FORMAT_ANNOTATION,
84
+ 'https://json-schema.org/draft/2020-12/vocab/format-assertion' => Draft202012::Vocab::FORMAT_ASSERTION,
85
+ 'https://json-schema.org/draft/2020-12/vocab/content' => Draft202012::Vocab::CONTENT,
86
+ 'https://json-schema.org/draft/2020-12/vocab/meta-data' => Draft202012::Vocab::META_DATA,
87
+
88
+ 'https://json-schema.org/draft/2019-09/vocab/core' => Draft201909::Vocab::CORE,
89
+ 'https://json-schema.org/draft/2019-09/vocab/applicator' => Draft201909::Vocab::APPLICATOR,
90
+ 'https://json-schema.org/draft/2019-09/vocab/validation' => Draft201909::Vocab::VALIDATION,
91
+ 'https://json-schema.org/draft/2019-09/vocab/format' => Draft201909::Vocab::FORMAT,
92
+ 'https://json-schema.org/draft/2019-09/vocab/content' => Draft201909::Vocab::CONTENT,
93
+ 'https://json-schema.org/draft/2019-09/vocab/meta-data' => Draft201909::Vocab::META_DATA,
94
+
95
+ 'json-schemer://draft7' => Draft7::Vocab::ALL,
96
+ 'json-schemer://draft6' => Draft6::Vocab::ALL,
97
+ 'json-schemer://draft4' => Draft4::Vocab::ALL,
37
98
 
38
- DEFAULT_META_SCHEMA = 'http://json-schema.org/draft-07/schema#'
99
+ 'https://spec.openapis.org/oas/3.1/vocab/base' => OpenAPI31::Vocab::BASE,
100
+ 'json-schemer://openapi30' => OpenAPI30::Vocab::BASE
101
+ }
102
+ VOCABULARY_ORDER = VOCABULARIES.transform_values.with_index { |_vocabulary, index| index }
39
103
 
40
104
  WINDOWS_URI_PATH_REGEX = /\A\/[a-z]:/i
41
105
 
@@ -44,33 +108,182 @@ module JSONSchemer
44
108
  raise InvalidFileURI, 'cannot have a host (use `file:///`)' if uri.host && !uri.host.empty?
45
109
  path = uri.path
46
110
  path = path[1..-1] if path.match?(WINDOWS_URI_PATH_REGEX)
47
- JSON.parse(File.read(path))
111
+ JSON.parse(File.read(URI::DEFAULT_PARSER.unescape(path)))
48
112
  end
49
113
 
50
114
  class << self
51
115
  def schema(schema, **options)
116
+ schema = resolve(schema, options)
117
+ Schema.new(schema, **options)
118
+ end
119
+
120
+ def valid_schema?(schema, **options)
121
+ schema = resolve(schema, options)
122
+ meta_schema(schema, options).valid?(schema, **options.slice(:output_format, :resolve_enumerators, :access_mode))
123
+ end
124
+
125
+ def validate_schema(schema, **options)
126
+ schema = resolve(schema, options)
127
+ meta_schema(schema, options).validate(schema, **options.slice(:output_format, :resolve_enumerators, :access_mode))
128
+ end
129
+
130
+ def draft202012
131
+ @draft202012 ||= Schema.new(
132
+ Draft202012::SCHEMA,
133
+ :base_uri => Draft202012::BASE_URI,
134
+ :formats => Draft202012::FORMATS,
135
+ :content_encodings => Draft202012::CONTENT_ENCODINGS,
136
+ :content_media_types => Draft202012::CONTENT_MEDIA_TYPES,
137
+ :ref_resolver => Draft202012::Meta::SCHEMAS.to_proc,
138
+ :regexp_resolver => 'ecma'
139
+ )
140
+ end
141
+
142
+ def draft201909
143
+ @draft201909 ||= Schema.new(
144
+ Draft201909::SCHEMA,
145
+ :base_uri => Draft201909::BASE_URI,
146
+ :formats => Draft201909::FORMATS,
147
+ :content_encodings => Draft201909::CONTENT_ENCODINGS,
148
+ :content_media_types => Draft201909::CONTENT_MEDIA_TYPES,
149
+ :ref_resolver => Draft201909::Meta::SCHEMAS.to_proc,
150
+ :regexp_resolver => 'ecma'
151
+ )
152
+ end
153
+
154
+ def draft7
155
+ @draft7 ||= Schema.new(
156
+ Draft7::SCHEMA,
157
+ :vocabulary => { 'json-schemer://draft7' => true },
158
+ :base_uri => Draft7::BASE_URI,
159
+ :formats => Draft7::FORMATS,
160
+ :content_encodings => Draft7::CONTENT_ENCODINGS,
161
+ :content_media_types => Draft7::CONTENT_MEDIA_TYPES,
162
+ :regexp_resolver => 'ecma'
163
+ )
164
+ end
165
+
166
+ def draft6
167
+ @draft6 ||= Schema.new(
168
+ Draft6::SCHEMA,
169
+ :vocabulary => { 'json-schemer://draft6' => true },
170
+ :base_uri => Draft6::BASE_URI,
171
+ :formats => Draft6::FORMATS,
172
+ :content_encodings => Draft6::CONTENT_ENCODINGS,
173
+ :content_media_types => Draft6::CONTENT_MEDIA_TYPES,
174
+ :regexp_resolver => 'ecma'
175
+ )
176
+ end
177
+
178
+ def draft4
179
+ @draft4 ||= Schema.new(
180
+ Draft4::SCHEMA,
181
+ :vocabulary => { 'json-schemer://draft4' => true },
182
+ :base_uri => Draft4::BASE_URI,
183
+ :formats => Draft4::FORMATS,
184
+ :content_encodings => Draft4::CONTENT_ENCODINGS,
185
+ :content_media_types => Draft4::CONTENT_MEDIA_TYPES,
186
+ :regexp_resolver => 'ecma'
187
+ )
188
+ end
189
+
190
+ def openapi31
191
+ @openapi31 ||= Schema.new(
192
+ OpenAPI31::SCHEMA,
193
+ :base_uri => OpenAPI31::BASE_URI,
194
+ :formats => OpenAPI31::FORMATS,
195
+ :ref_resolver => OpenAPI31::Meta::SCHEMAS.to_proc,
196
+ :regexp_resolver => 'ecma'
197
+ )
198
+ end
199
+
200
+ def openapi30
201
+ @openapi30 ||= Schema.new(
202
+ OpenAPI30::SCHEMA,
203
+ :vocabulary => {
204
+ 'json-schemer://draft4' => true,
205
+ 'json-schemer://openapi30' => true
206
+ },
207
+ :base_uri => OpenAPI30::BASE_URI,
208
+ :formats => OpenAPI30::FORMATS,
209
+ :ref_resolver => OpenAPI30::Meta::SCHEMAS.to_proc,
210
+ :regexp_resolver => 'ecma'
211
+ )
212
+ end
213
+
214
+ def openapi31_document
215
+ @openapi31_document ||= Schema.new(
216
+ OpenAPI31::Document::SCHEMA_BASE,
217
+ :ref_resolver => OpenAPI31::Document::SCHEMAS.to_proc,
218
+ :regexp_resolver => 'ecma'
219
+ )
220
+ end
221
+
222
+ def openapi30_document
223
+ @openapi30_document ||= Schema.new(
224
+ OpenAPI30::Document::SCHEMA,
225
+ :ref_resolver => OpenAPI30::Document::SCHEMAS.to_proc,
226
+ :regexp_resolver => 'ecma'
227
+ )
228
+ end
229
+
230
+ def openapi(document, **options)
231
+ OpenAPI.new(document, **options)
232
+ end
233
+
234
+ def configuration
235
+ @configuration ||= Configuration.new
236
+ end
237
+
238
+ def configure
239
+ yield configuration
240
+ end
241
+
242
+ private
243
+
244
+ def resolve(schema, options)
52
245
  case schema
53
246
  when String
54
- schema = JSON.parse(schema)
247
+ JSON.parse(schema)
55
248
  when Pathname
56
- uri = URI.parse(File.join('file:', schema.realpath))
249
+ base_uri = URI.parse(File.join('file:', URI::DEFAULT_PARSER.escape(schema.realpath.to_s)))
250
+ options[:base_uri] = base_uri
57
251
  if options.key?(:ref_resolver)
58
- schema = FILE_URI_REF_RESOLVER.call(uri)
252
+ FILE_URI_REF_RESOLVER.call(base_uri)
59
253
  else
60
- ref_resolver = CachedRefResolver.new(&FILE_URI_REF_RESOLVER)
61
- schema = ref_resolver.call(uri)
254
+ ref_resolver = CachedResolver.new(&FILE_URI_REF_RESOLVER)
62
255
  options[:ref_resolver] = ref_resolver
256
+ ref_resolver.call(base_uri)
63
257
  end
64
- schema[draft_class(schema)::ID_KEYWORD] ||= uri.to_s
258
+ else
259
+ schema
65
260
  end
66
- draft_class(schema).new(schema, **options)
67
261
  end
68
262
 
69
- private
70
-
71
- def draft_class(schema)
72
- meta_schema = schema.is_a?(Hash) && schema.key?('$schema') ? schema['$schema'] : DEFAULT_META_SCHEMA
73
- DRAFT_CLASS_BY_META_SCHEMA[meta_schema] || raise(UnsupportedMetaSchema, meta_schema)
263
+ def meta_schema(schema, options)
264
+ parseable_schema = {}
265
+ if schema.is_a?(Hash)
266
+ meta_schema = schema['$schema'] || schema[:'$schema']
267
+ parseable_schema['$schema'] = meta_schema if meta_schema.is_a?(String)
268
+ end
269
+ schema(parseable_schema, **options).meta_schema
74
270
  end
75
271
  end
272
+
273
+ META_SCHEMA_CALLABLES_BY_BASE_URI_STR = {
274
+ Draft202012::BASE_URI.to_s => method(:draft202012),
275
+ Draft201909::BASE_URI.to_s => method(:draft201909),
276
+ Draft7::BASE_URI.to_s => method(:draft7),
277
+ Draft6::BASE_URI.to_s => method(:draft6),
278
+ Draft4::BASE_URI.to_s => method(:draft4),
279
+ # version-less $schema deprecated after Draft 4
280
+ 'http://json-schema.org/schema#' => method(:draft4),
281
+ OpenAPI31::BASE_URI.to_s => method(:openapi31),
282
+ OpenAPI30::BASE_URI.to_s => method(:openapi30)
283
+ }.freeze
284
+
285
+ META_SCHEMAS_BY_BASE_URI_STR = Hash.new do |hash, base_uri_str|
286
+ next unless META_SCHEMA_CALLABLES_BY_BASE_URI_STR.key?(base_uri_str)
287
+ hash[base_uri_str] = META_SCHEMA_CALLABLES_BY_BASE_URI_STR.fetch(base_uri_str).call
288
+ end
76
289
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_schemer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.18
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Harsha
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-27 00:00:00.000000000 Z
11
+ date: 2024-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: base64
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -53,19 +67,75 @@ dependencies:
53
67
  - !ruby/object:Gem::Version
54
68
  version: '5.0'
55
69
  - !ruby/object:Gem::Dependency
56
- name: ecma-re-validator
70
+ name: simplecov
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '0.3'
62
- type: :runtime
75
+ version: '0.22'
76
+ type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '0.3'
82
+ version: '0.22'
83
+ - !ruby/object:Gem::Dependency
84
+ name: csv
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: i18n
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: i18n-debug
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: bigdecimal
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
69
139
  - !ruby/object:Gem::Dependency
70
140
  name: hana
71
141
  requirement: !ruby/object:Gem::Requirement
@@ -81,64 +151,109 @@ dependencies:
81
151
  - !ruby/object:Gem::Version
82
152
  version: '1.3'
83
153
  - !ruby/object:Gem::Dependency
84
- name: uri_template
154
+ name: regexp_parser
85
155
  requirement: !ruby/object:Gem::Requirement
86
156
  requirements:
87
157
  - - "~>"
88
158
  - !ruby/object:Gem::Version
89
- version: '0.7'
159
+ version: '2.0'
90
160
  type: :runtime
91
161
  prerelease: false
92
162
  version_requirements: !ruby/object:Gem::Requirement
93
163
  requirements:
94
164
  - - "~>"
95
165
  - !ruby/object:Gem::Version
96
- version: '0.7'
166
+ version: '2.0'
97
167
  - !ruby/object:Gem::Dependency
98
- name: regexp_parser
168
+ name: simpleidn
99
169
  requirement: !ruby/object:Gem::Requirement
100
170
  requirements:
101
171
  - - "~>"
102
172
  - !ruby/object:Gem::Version
103
- version: '2.0'
173
+ version: '0.2'
104
174
  type: :runtime
105
175
  prerelease: false
106
176
  version_requirements: !ruby/object:Gem::Requirement
107
177
  requirements:
108
178
  - - "~>"
109
179
  - !ruby/object:Gem::Version
110
- version: '2.0'
111
- description:
180
+ version: '0.2'
181
+ description:
112
182
  email:
113
183
  - davishmcclurg@gmail.com
114
- executables: []
184
+ executables:
185
+ - json_schemer
115
186
  extensions: []
116
187
  extra_rdoc_files: []
117
188
  files:
118
189
  - ".github/workflows/ci.yml"
119
190
  - ".gitignore"
191
+ - CHANGELOG.md
120
192
  - Gemfile
121
193
  - Gemfile.lock
122
194
  - LICENSE.txt
123
195
  - README.md
124
196
  - Rakefile
125
197
  - bin/console
198
+ - bin/hostname_character_classes
199
+ - bin/rake
126
200
  - bin/setup
201
+ - exe/json_schemer
127
202
  - json_schemer.gemspec
128
203
  - lib/json_schemer.rb
129
- - lib/json_schemer/cached_ref_resolver.rb
204
+ - lib/json_schemer/cached_resolver.rb
205
+ - lib/json_schemer/configuration.rb
206
+ - lib/json_schemer/content.rb
207
+ - lib/json_schemer/draft201909/meta.rb
208
+ - lib/json_schemer/draft201909/vocab.rb
209
+ - lib/json_schemer/draft201909/vocab/applicator.rb
210
+ - lib/json_schemer/draft201909/vocab/core.rb
211
+ - lib/json_schemer/draft202012/meta.rb
212
+ - lib/json_schemer/draft202012/vocab.rb
213
+ - lib/json_schemer/draft202012/vocab/applicator.rb
214
+ - lib/json_schemer/draft202012/vocab/content.rb
215
+ - lib/json_schemer/draft202012/vocab/core.rb
216
+ - lib/json_schemer/draft202012/vocab/format_annotation.rb
217
+ - lib/json_schemer/draft202012/vocab/format_assertion.rb
218
+ - lib/json_schemer/draft202012/vocab/meta_data.rb
219
+ - lib/json_schemer/draft202012/vocab/unevaluated.rb
220
+ - lib/json_schemer/draft202012/vocab/validation.rb
221
+ - lib/json_schemer/draft4/meta.rb
222
+ - lib/json_schemer/draft4/vocab.rb
223
+ - lib/json_schemer/draft4/vocab/validation.rb
224
+ - lib/json_schemer/draft6/meta.rb
225
+ - lib/json_schemer/draft6/vocab.rb
226
+ - lib/json_schemer/draft7/meta.rb
227
+ - lib/json_schemer/draft7/vocab.rb
228
+ - lib/json_schemer/draft7/vocab/validation.rb
229
+ - lib/json_schemer/ecma_regexp.rb
130
230
  - lib/json_schemer/errors.rb
131
231
  - lib/json_schemer/format.rb
132
- - lib/json_schemer/schema/base.rb
133
- - lib/json_schemer/schema/draft4.rb
134
- - lib/json_schemer/schema/draft6.rb
135
- - lib/json_schemer/schema/draft7.rb
232
+ - lib/json_schemer/format/duration.rb
233
+ - lib/json_schemer/format/email.rb
234
+ - lib/json_schemer/format/hostname.rb
235
+ - lib/json_schemer/format/json_pointer.rb
236
+ - lib/json_schemer/format/uri_template.rb
237
+ - lib/json_schemer/keyword.rb
238
+ - lib/json_schemer/location.rb
239
+ - lib/json_schemer/openapi.rb
240
+ - lib/json_schemer/openapi30/document.rb
241
+ - lib/json_schemer/openapi30/meta.rb
242
+ - lib/json_schemer/openapi30/vocab.rb
243
+ - lib/json_schemer/openapi30/vocab/base.rb
244
+ - lib/json_schemer/openapi31/document.rb
245
+ - lib/json_schemer/openapi31/meta.rb
246
+ - lib/json_schemer/openapi31/vocab.rb
247
+ - lib/json_schemer/openapi31/vocab/base.rb
248
+ - lib/json_schemer/output.rb
249
+ - lib/json_schemer/result.rb
250
+ - lib/json_schemer/schema.rb
136
251
  - lib/json_schemer/version.rb
137
252
  homepage: https://github.com/davishmcclurg/json_schemer
138
253
  licenses:
139
254
  - MIT
140
255
  metadata: {}
141
- post_install_message:
256
+ post_install_message:
142
257
  rdoc_options: []
143
258
  require_paths:
144
259
  - lib
@@ -146,15 +261,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
146
261
  requirements:
147
262
  - - ">="
148
263
  - !ruby/object:Gem::Version
149
- version: '2.4'
264
+ version: '2.7'
150
265
  required_rubygems_version: !ruby/object:Gem::Requirement
151
266
  requirements:
152
267
  - - ">="
153
268
  - !ruby/object:Gem::Version
154
269
  version: '0'
155
270
  requirements: []
156
- rubygems_version: 3.1.4
157
- signing_key:
271
+ rubygems_version: 3.5.3
272
+ signing_key:
158
273
  specification_version: 4
159
- summary: JSON Schema validator. Supports drafts 4, 6, and 7.
274
+ summary: JSON Schema validator. Supports drafts 4, 6, 7, 2019-09, 2020-12, OpenAPI
275
+ 3.0, and OpenAPI 3.1.
160
276
  test_files: []
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
- module JSONSchemer
3
- class CachedRefResolver
4
- def initialize(&ref_resolver)
5
- @ref_resolver = ref_resolver
6
- @cache = {}
7
- end
8
-
9
- def call(uri)
10
- @cache[uri] = @ref_resolver.call(uri) unless @cache.key?(uri)
11
- @cache[uri]
12
- end
13
- end
14
- end