Documentation
¶
Index ¶
- Variables
- func GetOpenAPISpecJSON() ([]byte, error)
- type AnyType1
- type AnyType2
- type CustomStringType
- type DeprecatedProperty
- type EnsureEverythingIsReferencedJSONResponse
- type EnumInObjInArray
- type EnumInObjInArrayItem
- type EnumInObjInArrayVal
- type GenericObject
- type InnerRenamedAnonymousObject
- type Issue1051JSONResponse2001
- type Issue1051JSONResponse2002
- type N5StartsWithNumber
- type Nullable
- func (n Nullable[T]) Get() (T, error)
- func (n Nullable[T]) IsNull() bool
- func (n Nullable[T]) IsSpecified() bool
- func (n Nullable[T]) MarshalJSON() ([]byte, error)
- func (n Nullable[T]) MustGet() T
- func (n *Nullable[T]) Set(value T)
- func (n *Nullable[T]) SetNull()
- func (n *Nullable[T]) SetUnspecified()
- func (n *Nullable[T]) UnmarshalJSON(data []byte) error
- type NullableProperties
- type OuterTypeWithAnonymousInner
Constants ¶
This section is empty.
Variables ¶
var ErrNullableIsNull = errors.New("nullable value is null")
ErrNullableIsNull is returned when trying to get a value from a null Nullable.
var ErrNullableNotSpecified = errors.New("nullable value is not specified")
ErrNullableNotSpecified is returned when trying to get a value from an unspecified Nullable.
Functions ¶
func GetOpenAPISpecJSON ¶
GetOpenAPISpecJSON returns the raw OpenAPI spec as JSON bytes.
Types ¶
type AnyType2 ¶
type AnyType2 = any
#/components/schemas/AnyType2 AnyType2 represents any type.
This should be an interface{}
type DeprecatedProperty ¶
type DeprecatedProperty struct {
// Use this now!
NewProp string `json:"newProp" form:"newProp"`
OldProp1 *string `json:"oldProp1,omitempty" form:"oldProp1,omitempty"`
// It used to do this and that
OldProp2 *string `json:"oldProp2,omitempty" form:"oldProp2,omitempty"`
// Deprecated: Use NewProp instead!
OldProp3 *string `json:"oldProp3,omitempty" form:"oldProp3,omitempty"`
// It used to do this and that
// Deprecated: Use NewProp instead!
OldProp4 *string `json:"oldProp4,omitempty" form:"oldProp4,omitempty"`
}
#/components/schemas/DeprecatedProperty
func (*DeprecatedProperty) ApplyDefaults ¶
func (s *DeprecatedProperty) ApplyDefaults()
ApplyDefaults sets default values for fields that are nil.
type EnsureEverythingIsReferencedJSONResponse ¶
type EnsureEverythingIsReferencedJSONResponse struct {
AnyType1 *AnyType1 `json:"anyType1,omitempty" form:"anyType1,omitempty"`
AnyType2 *AnyType2 `json:"anyType2,omitempty" form:"anyType2,omitempty"`
CustomStringType *CustomStringType `json:"customStringType,omitempty" form:"customStringType,omitempty"`
}
#/paths//ensure-everything-is-referenced/get/responses/200/content/application/json/schema
func (*EnsureEverythingIsReferencedJSONResponse) ApplyDefaults ¶
func (s *EnsureEverythingIsReferencedJSONResponse) ApplyDefaults()
ApplyDefaults sets default values for fields that are nil.
type EnumInObjInArray ¶
type EnumInObjInArray = []EnumInObjInArrayItem
#/components/schemas/EnumInObjInArray
type EnumInObjInArrayItem ¶
type EnumInObjInArrayItem struct {
Val *string `json:"val,omitempty" form:"val,omitempty"`
}
#/components/schemas/EnumInObjInArray/items
func (*EnumInObjInArrayItem) ApplyDefaults ¶
func (s *EnumInObjInArrayItem) ApplyDefaults()
ApplyDefaults sets default values for fields that are nil.
type EnumInObjInArrayVal ¶
type EnumInObjInArrayVal string
#/components/schemas/EnumInObjInArray/items/properties/val
const ( First EnumInObjInArrayVal = "first" Second EnumInObjInArrayVal = "second" )
type GenericObject ¶
type GenericObject struct {
}
#/components/schemas/GenericObject
func (*GenericObject) ApplyDefaults ¶
func (s *GenericObject) ApplyDefaults()
ApplyDefaults sets default values for fields that are nil.
type InnerRenamedAnonymousObject ¶
type InnerRenamedAnonymousObject struct {
ID int `json:"id" form:"id"`
}
#/components/schemas/OuterTypeWithAnonymousInner/properties/inner
func (*InnerRenamedAnonymousObject) ApplyDefaults ¶
func (s *InnerRenamedAnonymousObject) ApplyDefaults()
ApplyDefaults sets default values for fields that are nil.
type Issue1051JSONResponse2001 ¶
type Issue1051JSONResponse2001 struct {
}
#/paths//issues/1051/get/responses/200/content/application/vnd.something.v1+json/schema
func (*Issue1051JSONResponse2001) ApplyDefaults ¶
func (s *Issue1051JSONResponse2001) ApplyDefaults()
ApplyDefaults sets default values for fields that are nil.
type Issue1051JSONResponse2002 ¶
type Issue1051JSONResponse2002 struct {
}
#/paths//issues/1051/get/responses/200/content/application/json/schema
func (*Issue1051JSONResponse2002) ApplyDefaults ¶
func (s *Issue1051JSONResponse2002) ApplyDefaults()
ApplyDefaults sets default values for fields that are nil.
type N5StartsWithNumber ¶
type N5StartsWithNumber struct {
}
#/components/schemas/5StartsWithNumber This schema name starts with a number
func (*N5StartsWithNumber) ApplyDefaults ¶
func (s *N5StartsWithNumber) ApplyDefaults()
ApplyDefaults sets default values for fields that are nil.
type Nullable ¶
Nullable is a generic type that can distinguish between: - Field not provided (unspecified) - Field explicitly set to null - Field has a value
This is implemented as a map[bool]T where: - Empty map: unspecified - map[false]T: explicitly null - map[true]T: has a value
func NewNullNullable ¶
NewNullNullable creates a Nullable that is explicitly null.
func NewNullableWithValue ¶
NewNullableWithValue creates a Nullable with the given value.
func (Nullable[T]) IsSpecified ¶
IsSpecified returns true if the field was provided (either null or a value).
func (Nullable[T]) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Nullable[T]) MustGet ¶
func (n Nullable[T]) MustGet() T
MustGet returns the value or panics if null or unspecified.
func (*Nullable[T]) SetNull ¶
func (n *Nullable[T]) SetNull()
SetNull marks the field as explicitly null.
func (*Nullable[T]) SetUnspecified ¶
func (n *Nullable[T]) SetUnspecified()
SetUnspecified clears the field (as if it was never set).
func (*Nullable[T]) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type NullableProperties ¶
type NullableProperties struct {
Optional *string `json:"optional,omitempty" form:"optional,omitempty"`
OptionalAndNullable Nullable[string] `json:"optionalAndNullable,omitempty" form:"optionalAndNullable,omitempty"`
Required string `json:"required" form:"required"`
RequiredAndNullable Nullable[string] `json:"requiredAndNullable" form:"requiredAndNullable"`
}
#/components/schemas/NullableProperties
func (*NullableProperties) ApplyDefaults ¶
func (s *NullableProperties) ApplyDefaults()
ApplyDefaults sets default values for fields that are nil.
type OuterTypeWithAnonymousInner ¶
type OuterTypeWithAnonymousInner struct {
Name string `json:"name" form:"name"`
Inner InnerRenamedAnonymousObject `json:"inner" form:"inner"`
}
#/components/schemas/OuterTypeWithAnonymousInner
func (*OuterTypeWithAnonymousInner) ApplyDefaults ¶
func (s *OuterTypeWithAnonymousInner) ApplyDefaults()
ApplyDefaults sets default values for fields that are nil.