eclipsesource/play-json-schema-validator

multiple environments

Closed this issue · 2 comments

Hi,

I guess its more question/request for ideas rather then an issue.

when using the "id" in order to specify full path (file or url) for the location of the main schema, in order to be able use relative paths for sub schemas, how is it possible to work in different environments which cause to the base path (like url) to be changed. (for example on my local http://127.0.0.1:9000/schemas/json/file.json, how ever in test env "http://mytest.com:8000/schemas/json/file.json") ?

except manually changing the "id" value, is there any other ideas ?

** will be nice to have option to define ENV variables inside the schema file, this can help a lot with such dynamic changes.

Thanks,

Hi,
sorry for the delay. You don't need to use the id keyword in order to use relative paths.
For instance, if your main schema is located at http://example.com/foo.json a reference from with foo.json to bar.json will be resolved to http://example.com/bar.json, i.e. the resolution scope from within foo.json will be http://example.com/. You only need the id keyword if you want to alter the resolution scope for whatever reason, e.g. because multiple referenced schemas are in a specific sub-folder or the like.
If this doesn't make sense (or I misunderstood your use case) please post a simplified example of your use case and I'll try to adopt it.t
Thank you!

I'm closing this, due to inactivity. Please feel free to re-open in case something is not clear. Thanks!