-
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
Allow optional fields for concrete types #1232
Comments
Adding 4 lines in place of what could be one, with an if statement and indents, makes this super unreadable on larger files |
Field accessors do work in guards
But this fails when bar is optional with https://cuelang.org/play/?id=Smvzvo90x8Q#cue@export@json It does seem restrictive to be unable to reference optional fields, especially when they are concrete. While it may be expected behavior today, is it desirable behavior? I'd have to reread the required fields proposal and think about if this changes afterwards. |
Ok, I see this is possible with
Any syntactic sugar to one-liner this would be greatly appreciated! Even |
It would be interesting to hear your opinion on whether #822 would address you issue. |
I agree. This is a very common pattern when deriving one struct from another, both of which have optional fields and it would be nice for it to be more syntactically lightweight. |
Strong need for this in thema, as well - having to do this is a significant source of complexity for lens authors |
Is your feature request related to a problem? Please describe.
Readability/usability. Take the following example of mapping from a source input to a target output:
Describe the solution you'd like
I'd like optional, concrete values to be evaluated/exported.
I'd also like to be able to leverage field accessors in conditional statements
Describe alternatives you've considered
N/A
Additional context
my_source is generated dynamically, and it is unclear what fields are set. We are manually creating the Mapping and applying to datasets that fit our source schema
The text was updated successfully, but these errors were encountered: