Skip to content

Templates and defaults #2295

Answered by verdverm
slewiskelly asked this question in Q&A
Mar 10, 2023 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

Your answer was and is close :]

What was happening is that the extra field did not prevent the a&b from being included in the result. Open structs in disjunctions are often a source of confusion or indecision (on CUE's part). By closing the disjunction element, it only applies on an exact match, or in this case when nothing is presented.

#A: foo: [string]: string

#B: #A & {
    foo: _ | *close({
	"a": "1"
	"b": "2"
    })
}

b: #B & {
	foo: "c": "3"
} 

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@slewiskelly
Comment options

@verdverm
Comment options

Answer selected by myitcv
@slewiskelly
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants