-
Notifications
You must be signed in to change notification settings - Fork 302
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
language: support optional markers for dynamic fields #2107
Comments
A smaller reproducer from @rogpeppe: https://tip.cuelang.org/play/?id=gGtOGipIe0B#cue@export@json |
Another reproducer from @rogpeppe and @mvdan: https://tip.cuelang.org/play/?id=MTJhnnEvkU8#cue@export@cue |
Marking as a feature request, because this is simply not supported yet. Arguably there should be a syntax error in the linked example until it is supported. |
Marking it as a feature request makes sense to but I do think it's a bug to allow an unsupported syntax to pass silently. |
Marked this as v0.6. With the eminent changes to optional field representations, this will be easy to make work. So rather than throwing an error, we will make this work. For now, you can write this as:
|
Thanks @mpvl! I'll keep on eye on it. |
@disintegrator - just to flag this got completed in c3138e3. Our bot doesn't do a good job of notifying when things get done! |
@myitcv amazing, thank you all! |
@myitcv thanks to any and all involved in adding this feature :-) May I ask which release you anticipate it'll be available in? |
@jpluscplusm it's already present in tip at the commit indicate, which means it's available in the pseudo version v0.6.0-0.dev.0.20230323113716-c3138e362ec8. The next version we will be tagging based on tip is an alpha of v0.6.0. |
What version of CUE are you using (
cue version
)?Does this issue reproduce with the latest release?
Yes
What did you do?
https://cuelang.org/play/?id=QTJz8OOP282#cue@export@cue
What did you expect to see?
I was expecting to get the same output as the following: https://cuelang.org/play/?id=U2gP5VJNJS-#cue@export@cue
out: {}
or more accurately
What did you see instead?
The fields that resulted from the comprehension were not marked as optional. The optional marker was ignored and I got the following:
Keywords: string interpolation, field name expression, optional fields, structs
The text was updated successfully, but these errors were encountered: