File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,10 @@ def validate_schema!
50
50
accept_uri : false ,
51
51
accept_file : -> ( path ) { path . to_s . start_with? ( Gem . loaded_specs [ "json-schema" ] . full_gem_path ) } ,
52
52
)
53
- metaschema = JSON ::Validator . validator_for_name ( "draft4" ) . metaschema
53
+ metaschema_path = Pathname . new ( JSON ::Validator . validator_for_name ( "draft4" ) . metaschema )
54
+ # Converts metaschema to a file URI for cross-platform compatibility
55
+ metaschema_uri = JSON ::Util ::URI . file_uri ( metaschema_path . expand_path . cleanpath . to_s . tr ( "\\ " , "/" ) )
56
+ metaschema = metaschema_uri . to_s
54
57
errors = JSON ::Validator . fully_validate ( metaschema , schema , schema_reader : schema_reader )
55
58
if errors . any?
56
59
raise ArgumentError , "Invalid JSON Schema: #{ errors . join ( ", " ) } "
Original file line number Diff line number Diff line change @@ -55,7 +55,10 @@ def validate_schema!
55
55
accept_uri : false ,
56
56
accept_file : -> ( path ) { path . to_s . start_with? ( Gem . loaded_specs [ "json-schema" ] . full_gem_path ) } ,
57
57
)
58
- metaschema = JSON ::Validator . validator_for_name ( "draft4" ) . metaschema
58
+ metaschema_path = Pathname . new ( JSON ::Validator . validator_for_name ( "draft4" ) . metaschema )
59
+ # Converts metaschema to a file URI for cross-platform compatibility
60
+ metaschema_uri = JSON ::Util ::URI . file_uri ( metaschema_path . expand_path . cleanpath . to_s . tr ( "\\ " , "/" ) )
61
+ metaschema = metaschema_uri . to_s
59
62
errors = JSON ::Validator . fully_validate ( metaschema , schema , schema_reader : schema_reader )
60
63
if errors . any?
61
64
raise ArgumentError , "Invalid JSON Schema: #{ errors . join ( ", " ) } "
You can’t perform that action at this time.
0 commit comments