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

$ref support, with relative paths for $id. #155

Open
danywu opened this issue Aug 28, 2022 · 2 comments
Open

$ref support, with relative paths for $id. #155

danywu opened this issue Aug 28, 2022 · 2 comments

Comments

@danywu
Copy link

danywu commented Aug 28, 2022

I have a bunch of schemas that use relative paths for $ids, e.g. /components/0.1/crs, being referenced in /elements/0.1/points, and so on. There's a folder structure that reflects those paths in the $ids. These schemas will be "deployed" to various environments, e.g. dev, staging, etc. I would like to keep the $ids relative for flexibility.

In the documentation, I could not find a way of specifying the base URI for all the schemas in the "top level". Is this something that is supported, or planned to be?

@pspot2
Copy link

pspot2 commented Oct 27, 2022

@danywu are you already using this feature for validation, e.g. are you already using a validator where you can set the base URI externally and you would like to re-use the same schema files both for validation and for documentation generation?

If not, then the only way would be to set it statically in the $id of the top-level schema to something universal that would be present in all envs (for example, /var/tmp/something). This should make any JSON schema software happy, including this tool.

@danywu
Copy link
Author

danywu commented Jan 8, 2023

@danywu are you already using this feature for validation, e.g. are you already using a validator where you can set the base URI externally and you would like to re-use the same schema files both for validation and for documentation generation?

Yes, we are using this for validation already, by setting the base URI.

If not, then the only way would be to set it statically in the $id of the top-level schema to something universal that would be present in all envs (for example, /var/tmp/something). This should make any JSON schema software happy, including this tool.

Our schemas will be served through CDN, so the path will depend on the environments, e.g. ourschemas.com, dev.ourschemas.com, etc.

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

2 participants