Skip to content

Commit

Permalink
Document the choice of options given to Validate()
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Phoen committed Jul 18, 2023
1 parent 0b0e794 commit 39dd337
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ func (sch *schemaDef) Validate(data cue.Value) (*Instance, error) {
// }

x := sch.def.Unify(data)
if err := x.Validate(cue.Concrete(true), cue.All()); err != nil {

// The cue.Concrete(true) option ensure that Concrete all values resulting
// from the unification of the schema and data are concrete.
// ie: every field defined by the schema has a concrete value associated to it,
// and no required field was omitted.
if err := x.Validate(cue.Concrete(true)); err != nil {
return nil, mungeValidateErr(err, sch)
}

Expand Down

0 comments on commit 39dd337

Please sign in to comment.