You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a separate Fill call that sets defaults, it still uses v1alpha1.MyType, but somehow not having the type declared in the template makes it work. Albeit, as soon as one of the fields is not set in defaults, I get my TypeMeta error back again.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Originally opened by @errordeveloper in cuelang/cue#439
I have am using CUE in a Kubernetes operator, I am trying to pass my API type to CUE, and seeing this error:
My template looks like this:
The generated CUE types look like this:
I tried changing the type definition by removing
metav1.TypeMeta
, and the error I got was this:I figured I'd try adding default values in my CUE tempate:
That worked. I then added
metav1.TypeMeta
back and all works now.I don't really understand why is this happening, could someone explain? What can I do to avoid having default values in the template?
I am pretty sure that
TypeMeta
error is a misleading actually, it only seems happens when an optional value has no default.Here is a more elegant work-around:
I have a separate
Fill
call that setsdefaults
, it still usesv1alpha1.MyType
, but somehow not having the type declared in the template makes it work. Albeit, as soon as one of the fields is not set indefaults
, I get myTypeMeta
error back again.Beta Was this translation helpful? Give feedback.
All reactions