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

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
f1: "some string value"
# f-2: field is missing
  f3: 7
$ cue vet .:example data.yml
"f-2": field is required but not present: