Fix schema: config:spack:packages is a required entry#247
Fix schema: config:spack:packages is a required entry#247
config:spack:packages is a required entry#247Conversation
|
Now I see that maybe this has not been enforced because of back-compatibility. |
msimberg
left a comment
There was a problem hiding this comment.
Thanks @albestro. I think I initially had it required when the entry was its own top-level entry. I think I lost the required property when moving it under spack.
Now I see that maybe this has not been enforced because of back-compatibility.
That was certainly not a conscious choice...
But in the future, we might opt for having official repos as defaults.
I'm in principle in favour of this, but I also like just keeping everything explicit. I don't feel strongly about either option.
for unevaluatedProperties feature
63c6f23 to
134b70d
Compare
|
I'm an absolute newbie with JSON schemas, but I took the chance to learn a bit about them to trying improving the Main changes:
I quickly tested the new schema against https://github.com/eth-cscs/alps-uenv/tree/main and eth-cscs/alps-uenv#224, and it didn't report any problem. At the moment no test has been added for trivially wrong configs (e.g. missing This PR would shift the error detection towards the schema validation phase instead of raising a python exception. On one side, I'm not sure how much nicer it is to get a strange json validation error message compared to a failure in python code, on the other side if previous statement leans towards python errors then one might ask why we have json schemas. Maybe it is preferrable to have "loose" schemas like they are now, but it sounds like a strange choice. In any case, this PR could just be an interesting (for me) experiment, and we can even drop it if it's not the path we'd like to pursue (or try to cherry-pick a couple of easy things, e.g. required Looking forward to your comments. |
A look at validation error messagesCurrent solution in this PR does not really give useful error messages. I had a quick look at error messages of production version, which might give nicer error messages in some cases, but it's way more loose on many constraints. name: "test"
version: 1
spack:Gives But apparently it has more information in it that could be helpful or |
Close eth-cscs#247 **Rationale:** Current version of stackinator does not support older versions of `config.yaml` (as stated by the error message reported below), so I don't see the point in having a back-compatible schema (like I was trying with eth-cscs#247). https://github.com/eth-cscs/stackinator/blob/a4db2ee7d8bd0355f8082fe8405a48c0226b0099/stackinator/recipe.py#L58-L67 **Proposal:** the schema should support just the current supported version, same for tests which should just care about currently supported version (at most, check that unsupported version are correctly reported with a user-friendly error message). **Changelog:** - move version check logic as a pre-check in the validation step - adapt tests and test resources to `version: 2` - took the chance to customize the error message (more in following comment)
config:spack:packagesis a required entry but the schema has not been updated to reflect that.The "minimal" required entry for
config.yamlisFor this PR the easiest way was also the one that made most sense to me.
But in the future, we might opt for having official repos as defaults.