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

[FR] Add the ability to load schemas that can be referenced in other schemas #155

Open
abravalheri opened this issue Feb 12, 2024 · 3 comments

Comments

@abravalheri
Copy link
Owner

abravalheri commented Feb 12, 2024

--store is broken (I think) as a subschema now references another schema (base.json for poetry’s license). I think this is a good opportunity to add the ability to load --extra schemas that can be referenced and --store will load them and the new api would have a way to provide them.

Originally posted by @henryiii in #144 (comment)

REF: SchemaStore/schemastore#3519 (comment)

@abravalheri abravalheri changed the title Add the ability to load schemas that can be referenced in other schemas [FR] Add the ability to load schemas that can be referenced in other schemas Feb 12, 2024
@abravalheri
Copy link
Owner Author

Additionally, should we allow missing schemas to be downloaded from the base URL of the value specified via --store?

There is an assumption there: when store is given $id always correspond to a downloadable URL. But I guess that we are already using this assumption.

@henryiii
Copy link
Collaborator

henryiii commented Feb 12, 2024

This was fixed (for now) in SchemaStore by reverting the change in SchemaStore/schemastore#3568, I think because it broke us and one other tool. I personally think it was not the right thing anyway, as Poetry's license field supports more than just SPDX identifiers; "Proprietary" is even in the docs as the correct entry if you don't have an open license. But I could see it being an oneOf in the future. And some other field could eventually reference base.json or some other subschema. So it would be nice to fix it.

Currently, when --store is given, we download all tool.* ref's as URLs, which is valid for SchemaStore. The problem is that there can't be any ref's in the downloaded schemas, as we don't look them up, and we can't load an "extra" schema that is not directly a tool.* schema.

IMO, three change would be ideal: We should add --extra FILE, which loads a schema to be ref'd, --store FILE should recursively load extra refs, and #144 should have a way for a multi plugin to specify extras.

@abravalheri
Copy link
Owner Author

--store FILE should recursively load extra refs

This might be a bit tricky.
On a related note, SchemaStore's schema-validation.json does seem to list these schemas using externalSchema.

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