-
Notifications
You must be signed in to change notification settings - Fork 3
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
fix: Validate processing fields everywhere #6
fix: Validate processing fields everywhere #6
Conversation
05146ce
to
9926ac3
Compare
Hmm, interesting. Thanks for catching this. I'll investigate... |
cde1110
to
573cf70
Compare
Ping? |
|
Indeed, the anyOf is a problem. It's an issue in all extensions basically. If one of them is fullfilled, the others don't need to be fulfilled. You can fix this to some degree by making pure field validation with no field requirements in allOf and then add the requirements in anyOf. An example how I believe it can be solved: 8045be9 PS: I'm basically the only one who's doing all the JSON Schema maintenance for the whole STAC spec + extension, which I have like 1-2 hours per month allocated for. Fixing this here and throughout the STAC ecosystem will need a funding effort ( @cholmes ) so that someone can work on this for some time... |
573cf70
to
fb2c597
Compare
I've changed these to Jest. |
I have updated the JSON Schema to properly validate fields and requirements in #18 so this might be obsolete |
fb2c597
to
c56bb2e
Compare
The "should fail validation without any summaries processing: properties" test fails with the schema in the main branch. Also, this adds tests which are easier to read and understand in isolation than the schema itself, making sure that future changes don't break anything. |
Yes, but that is intended (if I understand the tests correctly) as there are still processing properties in providers. For Collections, it checks whether any place contains processing properties, so if any of summaries, assets, item_assets or providers have processing properties, the requirement for specifying at least one processing property is fulfilled. So the tests need to be fixed. See the note below the table for details: https://github.com/stac-extensions/processing#item-properties-and-collection-provider-fields |
It also fails "should fail validation with invalid providers processing:software value". |
I'll make sure it tests that. |
Haven't run your tests as I'm on my non-dev machine right now, but if I validate invalid stuff processing:software in providers in some online json schema validator it correctly throws an exception. So I guess something with your tests is wrong, maybe the expected error message has changed. Maybe it's worth checking the tests again. I've verified with around 25 different files and configurations that the schema works so I don't expect any major issues any more. |
c56bb2e
to
7d30fe1
Compare
Looks like you fixed the original issue, thank you! The tests should still be relevant. |
Anything missing to get this merged? |
I don't work with STAC anymore, so I've unsubscribed from this. Please @ me if you would like some further feedback. |
To reproduce the original issue:
.providers[0]['processing:software']['IPF-S2L1C']
to something not a string, such as2.6
.npm test
.The test passes even though the value should be considered invalid. I believe the reason for this is that
anyOf
requires that one of the sub-schemas are valid, not that one of the sub-schema structures are present. So even if some processing property values are invalid, as long as there is at least one valid value the JSON passes validation.Caveat: Some unit tests would be in order to make sure the schema does the right thing in many more cases. If you're interested I can add some of those as well.