You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am writing a Schema validator that can run on Linux (and Mac) and Windows platforms and I noticed something strange with the Schema Reader.
When I attempted to read a schema from disk on Windows it worked fine, but on Linux, I was getting ReadRefused Errors
Sample code
...
# The schema should not query external references, except for the meta-schemaschema_reader= ::JSON::Schema::Reader.new(accept_file: false,accept_uri: proc{ |uri| uri.host.nil? || ['json-schema.org'].include?(uri.host)},)@document_schema=schema_reader.read(@schema_file)
...
Where @schema_file is the absolute file path. On Linux for example /tmp/something/ and Windows C:/something
I am writing a Schema validator that can run on Linux (and Mac) and Windows platforms and I noticed something strange with the Schema Reader.
When I attempted to read a schema from disk on Windows it worked fine, but on Linux, I was getting ReadRefused Errors
Sample code
Where @schema_file is the absolute file path. On Linux for example
/tmp/something/
and WindowsC:/something
However it seems the logic used to detect URI vs file path is not setup for Windows paths correctly. https://github.com/ruby-json-schema/json-schema/blob/3f07ef0599c9a0e080840bfd1be04df433b7bbff/lib/json-schema/schema/reader.rb#L86
In a simple pry session:
The Windows paths appear as "URIs" instead of actual files on disk, therefore they never trigger the
accept_file
gating logicThe documentation for SchemaReader makes no mention of this behavior either.
How are we supposed to pass in Windows, and Linux, paths so that they get parsed correctly?
The text was updated successfully, but these errors were encountered: