Scalar Parameter Types
Scalar parameters define single-value fields in a definition's parameter schema. Each constructor returns a *Param that maps directly to a CUE primitive type and can be chained with modifiers like .Optional(), .Default(), and .Description().
defkit.String()
A UTF-8 string parameter. Optional by default — the field is emitted as field?: string. Use .Default(v) to emit a non-optional field with a default (field: *v | string), or .Mandatory() for a non-optional field without a default (field: string).
image := defkit.String("image") // optional by default
tag := defkit.String("tag").Default("latest")
comment := defkit.String("comment").Optional() // explicitly optional
image?: string
tag: *"latest" | string
comment?: string
defkit.Int()
A 64-bit integer parameter. Supports .Min(n) and .Max(n) for inclusive range constraints.
replicas := defkit.Int("replicas").Default(1).Min(1).Max(50)
port := defkit.Int("port")
replicas: *1 | int & >=1 & <=50
port?: int
defkit.Bool()
A boolean parameter. .Default(true) or .Default(false) sets the CUE default value.
enable := defkit.Bool("enable").Default(true)
debug := defkit.Bool("debug").Default(false)
enable: *true | bool
debug: *false | bool
defkit.Float()
A floating-point number parameter. Supports .Min(f) and .Max(f) for range constraints. Generates the CUE number type.
ratio := defkit.Float("ratio").Default(0.5).Min(0.0).Max(1.0)
weight := defkit.Float("weight")
ratio: *0.5 | number & >=0 & <=1
weight?: number
defkit.Enum()
A string parameter constrained to a fixed set of allowed values. Use .Values() — not .Enum() — to specify the allowed set (current convention as of defkit API update).
// Use .Values(), not .Enum() — current convention
pullPolicy := defkit.Enum("imagePullPolicy").
Values("Always", "Never", "IfNotPresent").
Default("IfNotPresent")
imagePullPolicy: *"IfNotPresent" | "Always" | "Never"
Combine .Values() with .Default() to pre-select one of the allowed values. The default appears first in the CUE disjunction with the * marker.