struct

CUE v0.18.0

Package struct defines utilities for struct types.

Functions

MaxFields validator

validator form

cue
func(n: int) -> validator({...})

call form

cue
func(object: {...}, n: int) -> bool

MaxFields validates the maximum number of fields that are part of a struct. It can only be used as a validator, for instance `MaxFields(3)`.

Only fields that are part of the data model count. This excludes hidden fields, optional fields, and definitions.

MinFields validator

validator form

cue
func(n: int) -> validator({...})

call form

cue
func(object: {...}, n: int) -> bool

MinFields validates the minimum number of fields that are part of a struct. It can only be used as a validator, for instance `MinFields(3)`.

Only fields that are part of the data model count. This excludes hidden fields, optional fields, and definitions.

Install CUE