output

package
v0.0.0-...-bb4e2af Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNullableIsNull = errors.New("nullable value is null")

ErrNullableIsNull is returned when trying to get a value from a null Nullable.

View Source
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

func GetOpenAPISpecJSON() ([]byte, error)

GetOpenAPISpecJSON returns the raw OpenAPI spec as JSON bytes.

Types

type AnyType1

type AnyType1 = any

#/components/schemas/AnyType1

type AnyType2

type AnyType2 = any

#/components/schemas/AnyType2 AnyType2 represents any type.

This should be an interface{}

type CustomStringType

type CustomStringType = string

#/components/schemas/CustomStringType

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

type Nullable[T any] map[bool]T

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

func NewNullNullable[T any]() Nullable[T]

NewNullNullable creates a Nullable that is explicitly null.

func NewNullableWithValue

func NewNullableWithValue[T any](value T) Nullable[T]

NewNullableWithValue creates a Nullable with the given value.

func (Nullable[T]) Get

func (n Nullable[T]) Get() (T, error)

Get returns the value if set, or an error if null or unspecified.

func (Nullable[T]) IsNull

func (n Nullable[T]) IsNull() bool

IsNull returns true if the field is explicitly null.

func (Nullable[T]) IsSpecified

func (n Nullable[T]) IsSpecified() bool

IsSpecified returns true if the field was provided (either null or a value).

func (Nullable[T]) MarshalJSON

func (n Nullable[T]) MarshalJSON() ([]byte, error)

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]) Set

func (n *Nullable[T]) Set(value T)

Set assigns a value.

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

func (n *Nullable[T]) UnmarshalJSON(data []byte) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL