-
Notifications
You must be signed in to change notification settings - Fork 23
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
test
change directory structure for invalid yaml tests
#410
Conversation
Addresses #405 |
which is (I believe) disallowed. Authored by @mzuenni and committed by @RagnarGrootKoerkamp , please comment. ( |
I don't think we depend on any unknown keys currently, not nested and not in the root. Reason to allow them:
Reason to forbid them:
I'd say disallowing nested unknown keys is good for sure, and can also be convinced to drop root unknown keys. |
Note to self: What do we do with this one? visualizer: /visualizers/asy.py
data:
invalid_inputs:
visualizer: /foo
data:
foo:
in: "1 2 3"
sample:
data:
foo:
in: "a b c"
secret:
data:
'bar':
in: "x y z" This is nonsense (invalid inputs can’t be visualised, so it makes no sense to specify a visualiser for them). No schema forbids this. I think we can ignore this. (I have it lying around as a yaml file to possibly validate against.) |
The shiny new script at
The offending problems are the multipass problems in test. Should I just give them a pathological |
OK, Step 1 done. What’s new is that This is already useful and replaces with pride the CI line
(which should now just run the bash script instead). Next step is to also validate the same files against the JSON schema. |
As for
a useful key I’d like to advocate for is version: =~ "[0-9]{4}-[0-9]{2}" | *"2024-11" |
test/generator_yaml/test_schemata.sh
Outdated
echo -n "Processing $file... " | ||
output=$(cue vet "$file" $schemadir/*.cue -d "#Generators" 2>&1) | ||
exit_code=$? | ||
if [ $exit_code -eq 0 ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both here and below: you may want to check for 0, 1, and anything else, to catch cue crashes? (But that should be rare so maybe not worth the effort.)
|
I found an inconsistency. The JSON schema has (after converting back to CUE for readability):
whereas the CUE scheme has
This makes a difference, for instance for secret:
data:
- small:
testdata.yaml:
output_validator_flags: space_change_sensitive
input_validator_flags:
connected: --small
strongly-connected: --small thus following the CUE schema. In problemformatpackagespeak, both
and
Note that the latter ( I think I’ll try to upgrade the JSON schema. |
TODOs:
|
In # Solution ans visualizer must have an absolute path:
solution: a if an invalid generator, but that's clear already from the missing |
Here is where I register changes. In - dir: dir/ 306 I suggest to disallow the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some small comments, but overall things look nice :)
@@ -77,7 +77,7 @@ data: | |||
data: | |||
- dir: dir 300 | |||
- dir2: dir 301 | |||
- dir: dir/ 306 | |||
#- dir: dir/ 306 # TODO disallow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the comment is done now.
sample: {data: []} | ||
secret: | ||
data: | ||
1: b |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an int-type key right. Did we want to allow that?
Oh, was this the discussion that CUE can't distinguish yaml key types? Maybe add a comment as such here and in the commented out part of invalid.generators.yaml
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neither CUE nor JSON can see the difference between
1: foo
and
"1": "foo"
I’m not quite sure what is best here. I want to validate as much as possible in a schema language, but for the rest I think we need a python script. Undecided so far.
@@ -0,0 +1,2 @@ | |||
# The smallest valid generator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment says valid, but it's in the invalid directory
0e2bd2b
to
b1eb3f1
Compare
Work in progress on unified verification of various schemas for generators