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

Tautological self-reference in schema? #10

Closed
l0b0 opened this issue Sep 24, 2021 · 2 comments
Closed

Tautological self-reference in schema? #10

l0b0 opened this issue Sep 24, 2021 · 2 comments

Comments

@l0b0
Copy link
Contributor

l0b0 commented Sep 24, 2021

Isn't this self-reference tautological? Basically, if you're validating foo.json against bar.json it's because foo.json referenced bar.json in stac_extensions, right? Why validate that it does have that reference? Conversely, why validate a file against a schema it doesn't reference?

The only other side effect I can see is that this forces every STAC JSON file to list every extension any of the STAC extensions reference. So if schema foo references schema bar, and schema bar references baz, all STAC files which implement schema foo need to also list bar and baz in stac_extensions. This seems clunky:

  • Metadata authors shouldn't need to know about the internals of schemas. It should be enough for them to know which top-level schemas their metadata conforms to.
  • Each STAC object ends up referencing each schema it implements at least twice: once explicitly in stac_extensions, but also implicitly via each schema which references the other schema.
  • Bumping the version of one schema has the potential to lead to orphan schema references (bar no longer references baz) and validation errors (bar now references a new version of baz, and also references ban, which references bat, and so on).

Based on a PR and follow-up discussion.


Update:

I've changed my mind. My initial thinking was that the STAC metadata file would tell the JSON validator which schema to validate against. But it's also possible for the JSON validator caller to tell it which schema to use, independently of the contents of the STAC file. Since the schema reference in this case is outside of the STAC file it makes sense to enforce the contents of the STAC file this way.

dwsilk added a commit to linz/stac that referenced this issue Sep 27, 2021
kodiakhq bot pushed a commit to linz/stac that referenced this issue Oct 3, 2021
@m-mohr
Copy link
Contributor

m-mohr commented Oct 8, 2021

Thanks for keeping us in the loop, sorry for being so unresponsive (day work and so on, you know...).
It seems an issue could be created for stac-node-validator to allow selecting a list of schemas to validate against?
Other than that, can this issue be closed then?

@l0b0
Copy link
Contributor Author

l0b0 commented Oct 10, 2021

I think this can be closed as-is. We've moved to using ospec for unit testing changes to the examples, and those test against the specific schema we're interested in, so we can ensure stac_extensions content that way.

@l0b0 l0b0 closed this as completed Oct 10, 2021
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