Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected token error parsing URI for metaschema (I think) #326

Open
aviflax opened this issue May 9, 2016 · 0 comments
Open

Unexpected token error parsing URI for metaschema (I think) #326

aviflax opened this issue May 9, 2016 · 0 comments

Comments

@aviflax
Copy link

aviflax commented May 9, 2016

My setup is pretty strange so I understand if this is too obscure to troubleshoot.

I’m writing an app using JRuby (9.1.0.0) that uses a Maven plugin to package all the gems together into a… package. I think they get wrapped up into a jar file.

At runtime, I have a module with these two constants:

# Access resources on the classpath by prefixing the path with the scheme `classpath`
JSON_SCHEMA_PATH = 'classpath:/schemata/bay_event/bay_event_from_park_server.json'.freeze
JSON_SCHEMA = JSON.parse(File.read(JSON_SCHEMA_PATH)).freeze

… which works just fine.

Then I call the validator:

validation_errors = JSON::Validator.fully_validate schema, event,
                                                   validate_schema: true, insert_defaults: true

which also works fine.

The issue I’m having — which isn’t major, I think — is that I just happened to be running this app locally with Ruby’s “debug mode” enabled, wherein apparently (I’m new to Ruby) the interpreter will print out exceptions that are caught but don’t quite bubble up? (I’m a little confused as to why I’m seeing these actually. Maybe because the validation is running in a child thread… maybe the thread is dying but I can’t tell.) Anyway I’m seeing many of these messages in my console:

Exception `JSON::Schema::JsonParseError' at uri:classloader:/gems/json-schema-2.6.0/lib/json-schema/validator.rb:426 - unexpected token at 'uri:classloader://gems/json-schema-2.6.0/resources/draft-04.json'

I can’t catch these exceptions, so I guess they’re being caught somewhere within the validator.

So, a few questions:

  • I’m guessing that my schema isn’t actually being validated successfully — so that’s just being skipped? Is that right?
  • Any suggestions for fixing this? Is there a way for me give the validator an alternate path for the metaschema?

Thanks for reading all this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant