-
Notifications
You must be signed in to change notification settings - Fork 27
implement match for generate.yaml #483
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
base: main
Are you sure you want to change the base?
Conversation
|
Should we also allow this on the answer files? to ensure a testcase is (im)possible as intended. |
|
Consider bumping the generator framework version. The sample and the default in the CUE schema |
But Hm. I find this useful, but now it’s getting ugly. An idea for syntax that is consistent with the current proposal: I guess the schema is match: string | [...string] | {
in: string | [...string]
ans: string | [...string]
} |
|
even though this might be less yaml like i would prefer to not nest these and go for something like |
|
Just be make sure I was clear: I propose to retain as a valid expression, and expect it to be the widest-used form. I propose that the above is the same as (which, thanks to standard YAML syntax, can also be written as a one-liner, The situation in which the “mapping” form would mainly arise is when you want to specify something about I would advise against introducing more keys in the top-level mapping (such as The main alternatives I can see to my proposal would be to add [in|ans]: string | {
value: string
pattern: string | [...string]
}so you’d have expressions like this: This doesn’t smell right to me, but it’s just a hunch. |
|
I notice that we already have a plethora of stuff, namely The current semantics is that the key: value pair means " This is a case against introducing keys like My hunch is that the cleanest way is to enrich the right-hand side, instead of introducing more left-hand sides of such expressions. I think what I’m saying is allowing in: foo
match:
ans.statement: \d\w+ Alternatively, in: foo
ans.statement:
match: \d\w+ Dream state The dream state would be what CUE already supports out-of-the box: ans: "impossible" # ans must equal impossible
---
in: number & >0 # in must be a number, and strictly larger than 0
---
ans: "yes" | "no" # ans must be either "yes" or "no"
in.statement: =~"^\w\w$" # in.statement has two letters
in: !~"impossible" # in does not contain impossible
in: in.statement # in and in.statement are identicalIn other words, there’s a whole grammar on the right hand side supporting Note that explicit creation and constraint checking are the same: CUE just unifies everything it knows about, say This would be sah-weet! |
|
Interesting idea to do Should it be |
I don't like that, also feels weird in combination with generated testcases...
I dont think we need this for something else as
Unmatch would certainly be nice...
I am fine with that, even though I like to not nest things... :D The question is if/how we want to support unmatch than? |
The current proposal already supports “unmatching”, since regexen support that. Here are the three examples from upthread again, for a problem with output CUE of course would make this nicer to look at: |
I don't think that one is right? ( |
|
The only thing I’m unsure about for my negative lookahead regex is what do to with a possibly trailing newline. (I don’t understand the specification well enough.) So maybe it should be |
solves #312
@thorehusfeldt do you mind adjusting the schemas?