Skip to content

Surprising effect of bulk field templates #893

Answered by cueckoo
cueckoo asked this question in Q&A
Discussion options

You must be logged in to vote

Original reply by @myitcv in cuelang/cue#893 (comment)

AFAICT this is actually working as intended. The reason is that the Component.objects pattern constraint [string]: [string]: metadata: labels applies to existing fields (somewhat related I note the observations in cuelang/cue#1024, but this does not affect the analysis of this case). Hence it applies to Component.objects.ConfigMap, hence we see the following (using 0070bb10):

exec cue eval

-- x.cue --
package x

Component: {
	class: string

	objects: {
		ConfigMap: "\(class)-component": {
			kind:       "ConfigMap"
			apiVersion: "v1"
		}
	}

	objects: [string]: [string]: metadata: labels: {
		"class": class
	}
}

a: Component & {cla…

Replies: 3 comments

Comment options

cueckoo
Jul 3, 2021
Collaborator Author

You must be logged in to vote
0 replies
Comment options

cueckoo
Jul 3, 2021
Collaborator Author

You must be logged in to vote
0 replies
Comment options

cueckoo
Jul 3, 2021
Collaborator Author

You must be logged in to vote
0 replies
Answer selected by cueckoo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant