Closed
Description
I realize similar issues to this have come up before (eg here). I also realize this may be more of an implementation issue. If there is a better place to move this post, let me know. Basically, I want to avoid hardcoding any base URI references in a schema in order to better control dependencies in different environments (not unlike imports in a programming language).
A more concrete example:
- I have a login form frontend that uses json-schema for form validation
- I have a database server that uses json-schema for request validation
- I have a repo of json-schemas that I want to reuse in both places (let's call it the "schema-lib")
- In both the UI and the backend, I want to reference both local schemas and schemas from our schema-lib
- I have multiple deployments of the UI, the server, and the schema-lib (eg test, staging, production)
- When referencing schemas from the schema-lib, we need a configurable base URI that will change based on our environment
- (It would also be useful to configure and use multiple base URIs)
Here are a couple proposed solutions (both very much in the implementation layers):
- A hack using some template variables: https://gist.github.com/jayrbolton/117ca1d5bb9454c55a2295dda0df4d31
- Download remote schemas with a CLI and reference them all locally when validating, like an extremely stripped down package manager: https://gist.github.com/jayrbolton/e81fa352954bc29aea5bdce5bb4de92d
Side note: ideally, I would want to avoid any hard dependencies on http URLs to third party servers if I want the application to still work in a few years