This Commented CUE demonstrates using the required field marker in a schema to make sure that a field is present in data.

schema.cue
package example

// CUE indicates required fields with an
// exclamation mark: "!"

// f1 is required, and can be any value
f1!: _

// f-2 is required, and must be a string
"f-2"!: string

s1: {
	// f3 is required. It must be an integer
	// less than 10
	f3!: int & <10
}
data.yml
f1: "some string value"
# f-2: field is missing
s1:
  f3: 7
TERMINAL
$ cue vet .:example data.yml
"f-2": field is required but not present:
    ./schema.cue:10:1