File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -325,6 +325,10 @@ def parse
325
325
326
326
if value . key? ( '$ref' ) && keywords . fetch ( '$ref' ) . exclusive?
327
327
@parsed [ '$ref' ] = keywords . fetch ( '$ref' ) . new ( value . fetch ( '$ref' ) , self , '$ref' )
328
+ defs_keyword = meta_schema . defs_keyword
329
+ if value . key? ( defs_keyword ) && keywords . key? ( defs_keyword )
330
+ @parsed [ defs_keyword ] = keywords . fetch ( defs_keyword ) . new ( value . fetch ( defs_keyword ) , self , defs_keyword )
331
+ end
328
332
else
329
333
keyword_order = meta_schema . keyword_order
330
334
last = keywords . size
Original file line number Diff line number Diff line change @@ -364,4 +364,19 @@ def test_it_handles_relative_base_uri_json_pointer_ref
364
364
assert ( schema . valid? ( { 'bar' => 1 } ) )
365
365
refute ( schema . valid? ( { 'bar' => '1' } ) )
366
366
end
367
+
368
+ def test_exclusive_ref_supports_definitions
369
+ schema = JSONSchemer . schema ( {
370
+ '$schema' => 'http://json-schema.org/draft-07/schema#' ,
371
+ '$ref' => '#yah' ,
372
+ 'definitions' => {
373
+ 'yah' => {
374
+ '$id' => '#yah' ,
375
+ 'type' => 'integer'
376
+ }
377
+ }
378
+ } )
379
+ assert ( schema . valid? ( 1 ) )
380
+ refute ( schema . valid? ( '1' ) )
381
+ end
367
382
end
You can’t perform that action at this time.
0 commit comments