gonest
API Reference

Schema

gonest.NewSchema and PropertyBuilder branch reference

gonest.NewSchema[T](func(t *T, m *gonest.Schema) {...})

MethodDescription
Title("...")Name in components.schemas (defaults to Go type name).
Property(&t.X)Identify a field by pointer, returns a *PropertyBuilder.

Base constraints (every branch)

Required(), Nullable(), Description("..."), Examples(...)

Branches

BranchReturnsNotes
String(), Email(), Uuid(), Uri(), Hostname(), Ipv4(), Ipv6(), Password(), Byte(), Binary()*StringMetadataMin/Max/Pattern
Integer(), Int32(), Float(), Double()*NumericMetadataMin/Max
Boolean(), Date(), DateTime()*PropertyBuilderwrapper-less, base constraints only
Array()*ArrayMetadatadual-state (container vs. item), see .Items(fn)
Object(fn)*ObjectMetadatasingle-state, .Metadata(ref) / .AdditionalProperties()
Custom(fn func(raw any) (any, error))*PropertyBuilderuniversal escape hatch

Parsing functions

MustParseRestParams[T]/ParseRestParams[T], MustParseRestQuery[T]/ParseRestQuery[T], MustParseRestJsonBody[T]/ParseRestJsonBody[T], MustParseRestFormBody[T]/ParseRestFormBody[T].

See: Schema Builder Basics, Array Builder, Object Builder, Runtime Validation

On this page