Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{- $json := importStdPkg "encoding/json" -}}
{{- $errors := importStdPkg "errors" -}}
{{- $struct := .def.Type.Struct -}}
// UnmarshalJSON implements a custom JSON unmarshalling logic to decode `{{ .def.Name|formatObjectName }}` from JSON.
func (resource *{{ .def.Name|formatObjectName }}) UnmarshalJSON(raw []byte) error {
Expand Down
7 changes: 7 additions & 0 deletions internal/simplecue/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,13 @@ func getReference(v cue.Value) (bool, cue.Value, cue.Value) {
if op == cue.AndOp && exprs[0].Subsume(exprs[1]) == nil && exprs[1].Subsume(exprs[0]) == nil {
return true, exprs[0], exprs[1]
}

// We could have a reference unified with a cue.TopKind (_). We can assume that if we have an existing path unified with this
// it's a valid reference.
if path.String() != "" && exprs[1].IncompleteKind() == cue.TopKind {
return true, exprs[0], exprs[0]
}

return false, v, v
}

Expand Down
Loading