-
Notifications
You must be signed in to change notification settings - Fork 1
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
docs/howto: Ensuring a list is a subset of another list #169
Comments
@sa-spag is going to give writing this guide a try 👍 🎉 |
@sa-spag Hey there 👋 Just a friendly check-in ... did you manage to get anywhere with writing this How-to Guide? :-) |
👋 I had other priorities, but it is still in my backlog. |
That code is certainly more concise than what I ended up trying, though it gives error messages like:
This failure reporting is a bit verbose and could be a bit confusing to newcomers. It the meantime this is definitely helpful. Long term, matchN could perhaps provide better error reporting. The must/constrain proposal could also provide this if we had something like a
|
Yes, using allowed_values: ["a", "b", "c"]
my_values: ["a", "nope"]
my_values: matchN(1, allowed_values)
For the moment I'm going to defer to other folks about the relative suitability and appropriateness of either approach, specifically in the limited context of the guide this issue is tracking. |
This adds a guide demonstrating how to use CUE's built-in "or" function to ensure one list contains only values found in another list. A "matchN"-based approach could also be used to achieve this, but it might prove more fiddly to encode in a generic form that can be trivially copied and pasted by the reader. cue-lang/docs-and-content#169 is left open to track this additional possibility. For cue-lang/docs-and-content#169. Signed-off-by: Jonathan Matthews <[email protected]> Preview-Path: /docs/howto/ensure-list-is-subset-of-another-list/ Change-Id: Idc7a60d0290f26a2376189bdd4af56257ac3c8b2 Dispatch-Trailer: {"type":"trybot","CL":1206329,"patchset":1,"ref":"refs/changes/29/1206329/1","targetBranch":"master"}
This adds a guide demonstrating how to use CUE's built-in "or" function to ensure one list contains only values found in another list. It's also possible to use a "matchN"-based approach; cue-lang/docs-and-content#169 is left open to track this. For cue-lang/docs-and-content#169. Signed-off-by: Jonathan Matthews <[email protected]> Preview-Path: /docs/howto/ensure-list-values-present-in-another-list/ Change-Id: Idc7a60d0290f26a2376189bdd4af56257ac3c8b2 Dispatch-Trailer: {"type":"trybot","CL":1206329,"patchset":2,"ref":"refs/changes/29/1206329/2","targetBranch":"master"}
This adds a guide demonstrating how to use CUE's built-in "or" function to ensure one list contains only values found in another list. It's also possible to use a "matchN"-based approach; cue-lang/docs-and-content#169 is left open to track this. For cue-lang/docs-and-content#169. Signed-off-by: Jonathan Matthews <[email protected]> Preview-Path: /docs/howto/ensure-list-values-present-in-another-list/ Change-Id: Idc7a60d0290f26a2376189bdd4af56257ac3c8b2 Dispatch-Trailer: {"type":"trybot","CL":1206329,"patchset":3,"ref":"refs/changes/29/1206329/3","targetBranch":"master"}
A Commented CUE guide that demonstrates this solution to the problem:
Notes:
cue eval -i
/docs/howto/ensure-list-is-subset-of-another-list
feels like a suitable pathThe text was updated successfully, but these errors were encountered: