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 ComplexOptionalNullable

type ComplexOptionalNullable struct {
	// Optional and nullable
	AliasName Nullable[string] `json:"alias_name,omitempty" form:"alias_name,omitempty"`
	// Optional and non nullable
	Name *string `json:"name,omitempty" form:"name,omitempty"`
}

#/components/schemas/complex_optional_nullable Complex, optional and nullable

func (*ComplexOptionalNullable) ApplyDefaults

func (s *ComplexOptionalNullable) ApplyDefaults()

ApplyDefaults sets default values for fields that are nil.

type ComplexRequiredNullable

type ComplexRequiredNullable struct {
	// Optional and non nullable
	Name *string `json:"name,omitempty" form:"name,omitempty"`
}

#/components/schemas/complex_required_nullable Complex required and nullable

func (*ComplexRequiredNullable) ApplyDefaults

func (s *ComplexRequiredNullable) 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 PatchRequest

type PatchRequest struct {
	SimpleRequiredNullable    SimpleRequiredNullable            `json:"simple_required_nullable" form:"simple_required_nullable"`
	SimpleOptionalNullable    SimpleOptionalNullable            `json:"simple_optional_nullable,omitempty" form:"simple_optional_nullable,omitempty"`
	SimpleOptionalNonNullable *SimpleOptionalNonNullable        `json:"simple_optional_non_nullable,omitempty" form:"simple_optional_non_nullable,omitempty"`
	ComplexRequiredNullable   Nullable[ComplexRequiredNullable] `json:"complex_required_nullable" form:"complex_required_nullable"`
	ComplexOptionalNullable   Nullable[ComplexOptionalNullable] `json:"complex_optional_nullable,omitempty" form:"complex_optional_nullable,omitempty"`
	AdditionalProperties      map[string]any                    `json:"-"`
}

#/components/schemas/PatchRequest A request to patch an existing user object.

func (*PatchRequest) ApplyDefaults

func (s *PatchRequest) ApplyDefaults()

ApplyDefaults sets default values for fields that are nil.

func (PatchRequest) MarshalJSON

func (s PatchRequest) MarshalJSON() ([]byte, error)

func (*PatchRequest) UnmarshalJSON

func (s *PatchRequest) UnmarshalJSON(data []byte) error

type SimpleOptionalNonNullable

type SimpleOptionalNonNullable = string

#/components/schemas/simple_optional_non_nullable Simple optional and non nullable

type SimpleOptionalNullable

type SimpleOptionalNullable = Nullable[int]

#/components/schemas/simple_optional_nullable Simple optional and nullable

type SimpleRequiredNullable

type SimpleRequiredNullable = Nullable[int]

#/components/schemas/simple_required_nullable Simple required and nullable

Jump to

Keyboard shortcuts

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