
# Allow otherField
# Tests that comprehension-based schemas and deployment configurations correctly
# allow fields defined through pattern constraints and let comprehensions.
# Issue: https://cuelang.org/issue/317
-- in.cue --
#T: {
	#Schema: [_]: #D
	concrete: #Schema
}
#D: {
	fieldWithDefault: *0 | int
	...
}
s: #T & {
	#Schema: {
		foo: otherField: string
	}
	concrete: foo: otherField: "hello"
} @test(closed) @test(eq, {
	#Schema: foo: {
		fieldWithDefault: *0 | int
		otherField:       string
	}
	concrete: foo: {
		fieldWithDefault: *0 | int
		otherField:       "hello"
	}
})
#Container: {
	Env: [Name=string]: {
		name:  string
		value: string
	}
}
#Deployment: {
	#Containers: [Name=string]: #Container
	containers: [for c in #Containers {c}] // Problem is here.
}
Something: {
	#Deployment
	#Containers: {
		// Does not allow entries other than value. Either add ... or embed
		"a thing": Env: foobar: value: "foo"
	}
}
x: Something & #Deployment @test(closed) @test(eq, {
	#Containers: {
		"a thing": Env: foobar: {
			value: "foo"
			name:  string
		}
	}
	containers: [{
		Env: foobar: {
			name:  string
			value: "foo"
		}
	}]
})
-- out/eval/stats --
Leaks:  0
Freed:  52
Reused: 37
Allocs: 15
Retain: 0
Unifications: 46
Conjuncts:    96
Disjuncts:    6
NumCloseIDs: 21
