-
Notifications
You must be signed in to change notification settings - Fork 287
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
Validate the existence of fieldA xor fieldB #1349
Comments
See the |
You could use the anyOf work around with an upper limit as well. https://cuetorials.com/patterns/fields/#anyof The oneOf pattern there may be sufficient for your needs however val: {
{ item: string } | { items: [...string] }
} |
Thanks for raising this @ChristianKniep @seh is right, this is covered in #822 so will close this as a duplicate. |
I started with cue-lang and aim to use it to validate YAML. I want either to have a field called
item
oritems
, but not both and I am wondering how I can achieve that...My cue file looks like this:
And I suppose I need to add a check that checks if either of them is set, but not both.
(Writing the issue is almost rubber duck debugging - I might resolve the issue tomorrow already; hope that helps someone else)
Valid YAML
or
Invalid YAML
The text was updated successfully, but these errors were encountered: