Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MatchesResolvedValue ¶
func MatchesResolvedValue(schema ValueSchema, value ast.ResolvedValue) bool
Types ¶
type ArrayElementMode ¶
type ArrayElementMode int
const ( ArrayElementsHomogeneous ArrayElementMode = iota + 1 ArrayElementsAnyOf ArrayElementsTuple )
type ArraySchema ¶
type ArraySchema struct {
ElementSchemas []ValueSchema
ElementsMode ArrayElementMode
MinLen int
MaxLen int
}
func Array ¶
func Array(schemas ...ValueSchema) *ArraySchema
func ArrayOf ¶
func ArrayOf(schema ValueSchema) *ArraySchema
func Tuple ¶
func Tuple(schemas ...ValueSchema) *ArraySchema
func (*ArraySchema) Kind ¶
func (s *ArraySchema) Kind() ValueKind
func (*ArraySchema) Max ¶
func (s *ArraySchema) Max(length int) *ArraySchema
func (*ArraySchema) Min ¶
func (s *ArraySchema) Min(length int) *ArraySchema
type Definition ¶
func BuiltinComponents ¶
func BuiltinComponents() []Definition
func FindDefinition ¶
func FindDefinition(name string) (Definition, bool)
type Param ¶
type Param struct {
Name string
Schema ValueSchema
DefaultValue any
Description string
}
type RecordField ¶
type RecordField struct {
Name string
Schema ValueSchema
IsRequired bool
Description string
}
func Field ¶
func Field(name string, schema ValueSchema) RecordField
func (RecordField) Optional ¶
func (f RecordField) Optional() RecordField
func (RecordField) Required ¶
func (f RecordField) Required() RecordField
func (RecordField) RequiredField ¶
func (f RecordField) RequiredField() RecordField
func (RecordField) WithDescription ¶
func (f RecordField) WithDescription(description string) RecordField
type RecordSchema ¶
type RecordSchema struct {
Fields []RecordField
AllowUnknownKeys bool
MinFields int
MaxFields int
}
func Record ¶
func Record(fields ...RecordField) *RecordSchema
func (*RecordSchema) AllowUnknown ¶
func (s *RecordSchema) AllowUnknown() *RecordSchema
func (*RecordSchema) DisallowUnknownKeys ¶
func (s *RecordSchema) DisallowUnknownKeys() *RecordSchema
func (*RecordSchema) Kind ¶
func (s *RecordSchema) Kind() ValueKind
func (*RecordSchema) Max ¶
func (s *RecordSchema) Max(length int) *RecordSchema
func (*RecordSchema) Min ¶
func (s *RecordSchema) Min(length int) *RecordSchema
type ScalarSchema ¶
type ScalarSchema struct {
AllowedValues []any
Matcher func(ast.ResolvedValue) bool
// contains filtered or unexported fields
}
func Bool ¶
func Bool() *ScalarSchema
func Component ¶
func Component() *ScalarSchema
func ComponentValue ¶
func ComponentValue() *ScalarSchema
func Enum ¶
func Enum(values ...any) *ScalarSchema
func Integer ¶ added in v0.4.0
func Integer() *ScalarSchema
func String ¶
func String() *ScalarSchema
func (*ScalarSchema) Kind ¶
func (s *ScalarSchema) Kind() ValueKind
func (*ScalarSchema) Matching ¶
func (s *ScalarSchema) Matching(fn func(ast.ResolvedValue) bool) *ScalarSchema
func (*ScalarSchema) OneOf ¶
func (s *ScalarSchema) OneOf(values ...any) *ScalarSchema
type ValueSchema ¶
type ValueSchema interface {
Kind() ValueKind
}
Click to show internal directories.
Click to hide internal directories.