api

package
v1.19.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithServerURL

func WithServerURL(ctx context.Context, u *url.URL) context.Context

WithServerURL sets context key to override server URL.

Types

type Alias

type Alias testtypes.StringOgen

func (*Alias) Decode

func (s *Alias) Decode(d *jx.Decoder) error

Decode decodes Alias from json.

func (Alias) Encode

func (s Alias) Encode(e *jx.Encoder)

Encode encodes Alias as json.

func (Alias) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Alias) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type AliasPointer

type AliasPointer testtypes.StringOgen

func (*AliasPointer) Decode

func (s *AliasPointer) Decode(d *jx.Decoder) error

Decode decodes AliasPointer from json.

func (AliasPointer) Encode

func (s AliasPointer) Encode(e *jx.Encoder)

Encode encodes AliasPointer as json.

func (AliasPointer) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*AliasPointer) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client implements OAS client.

func NewClient

func NewClient(serverURL string, opts ...ClientOption) (*Client, error)

NewClient initializes new Client defined by OAS.

func (*Client) Optional

func (c *Client) Optional(ctx context.Context, params OptionalParams) (*OptionalOK, error)

Optional invokes optional operation.

GET /optional

func (*Client) Required

func (c *Client) Required(ctx context.Context, params RequiredParams) (*RequiredOK, error)

Required invokes required operation.

GET /required

type ClientOption

type ClientOption interface {
	// contains filtered or unexported methods
}

ClientOption is client config option.

func WithClient

func WithClient(client ht.Client) ClientOption

WithClient specifies http client to use.

type ErrorHandler

type ErrorHandler = ogenerrors.ErrorHandler

ErrorHandler is error handler.

type Handler

type Handler interface {
	// Optional implements optional operation.
	//
	// GET /optional
	Optional(ctx context.Context, params OptionalParams) (*OptionalOK, error)
	// Required implements required operation.
	//
	// GET /required
	Required(ctx context.Context, params RequiredParams) (*RequiredOK, error)
}

Handler handles operations described by OpenAPI v3 specification.

type Invoker

type Invoker interface {
	// Optional invokes optional operation.
	//
	// GET /optional
	Optional(ctx context.Context, params OptionalParams) (*OptionalOK, error)
	// Required invokes required operation.
	//
	// GET /required
	Required(ctx context.Context, params RequiredParams) (*RequiredOK, error)
}

Invoker invokes operations described by OpenAPI v3 specification.

type Labeler

type Labeler struct {
	// contains filtered or unexported fields
}

Labeler is used to allow adding custom attributes to the server request metrics.

func LabelerFromContext

func LabelerFromContext(ctx context.Context) (*Labeler, bool)

LabelerFromContext retrieves the Labeler from the provided context, if present.

If no Labeler was found in the provided context a new, empty Labeler is returned and the second return value is false. In this case it is safe to use the Labeler but any attributes added to it will not be used.

func (*Labeler) Add

func (l *Labeler) Add(attrs ...attribute.KeyValue)

Add attributes to the Labeler.

func (*Labeler) AttributeSet

func (l *Labeler) AttributeSet() attribute.Set

AttributeSet returns the attributes added to the Labeler as an attribute.Set.

type Middleware

type Middleware = middleware.Middleware

Middleware is middleware type.

type OperationName

type OperationName = string

OperationName is the ogen operation name

const (
	OptionalOperation OperationName = "Optional"
	RequiredOperation OperationName = "Required"
)

type OptAlias

type OptAlias struct {
	Value Alias
	Set   bool
}

OptAlias is optional Alias.

func NewOptAlias

func NewOptAlias(v Alias) OptAlias

NewOptAlias returns new OptAlias with value set to v.

func (*OptAlias) Decode

func (o *OptAlias) Decode(d *jx.Decoder) error

Decode decodes Alias from json.

func (OptAlias) Encode

func (o OptAlias) Encode(e *jx.Encoder)

Encode encodes Alias as json.

func (OptAlias) Get

func (o OptAlias) Get() (v Alias, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptAlias) IsSet

func (o OptAlias) IsSet() bool

IsSet returns true if OptAlias was set.

func (OptAlias) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptAlias) Or

func (o OptAlias) Or(d Alias) Alias

Or returns value if set, or given parameter if does not.

func (*OptAlias) Reset

func (o *OptAlias) Reset()

Reset unsets value.

func (*OptAlias) SetTo

func (o *OptAlias) SetTo(v Alias)

SetTo sets value to v.

func (*OptAlias) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptAliasPointer

type OptAliasPointer struct {
	Value AliasPointer
	Set   bool
}

OptAliasPointer is optional AliasPointer.

func NewOptAliasPointer

func NewOptAliasPointer(v AliasPointer) OptAliasPointer

NewOptAliasPointer returns new OptAliasPointer with value set to v.

func (*OptAliasPointer) Decode

func (o *OptAliasPointer) Decode(d *jx.Decoder) error

Decode decodes AliasPointer from json.

func (OptAliasPointer) Encode

func (o OptAliasPointer) Encode(e *jx.Encoder)

Encode encodes AliasPointer as json.

func (OptAliasPointer) Get

func (o OptAliasPointer) Get() (v AliasPointer, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptAliasPointer) IsSet

func (o OptAliasPointer) IsSet() bool

IsSet returns true if OptAliasPointer was set.

func (OptAliasPointer) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptAliasPointer) Or

Or returns value if set, or given parameter if does not.

func (*OptAliasPointer) Reset

func (o *OptAliasPointer) Reset()

Reset unsets value.

func (*OptAliasPointer) SetTo

func (o *OptAliasPointer) SetTo(v AliasPointer)

SetTo sets value to v.

func (*OptAliasPointer) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptAny

type OptAny struct {
	Value any
	Set   bool
}

OptAny is optional any.

func NewOptAny

func NewOptAny(v any) OptAny

NewOptAny returns new OptAny with value set to v.

func (*OptAny) Decode

func (o *OptAny) Decode(d *jx.Decoder, format func(*jx.Decoder) (any, error)) error

Decode decodes any from json.

func (OptAny) Encode

func (o OptAny) Encode(e *jx.Encoder, format func(*jx.Encoder, any))

Encode encodes any as json.

func (OptAny) Get

func (o OptAny) Get() (v any, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptAny) IsSet

func (o OptAny) IsSet() bool

IsSet returns true if OptAny was set.

func (OptAny) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptAny) Or

func (o OptAny) Or(d any) any

Or returns value if set, or given parameter if does not.

func (*OptAny) Reset

func (o *OptAny) Reset()

Reset unsets value.

func (*OptAny) SetTo

func (o *OptAny) SetTo(v any)

SetTo sets value to v.

func (*OptAny) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptBinary

type OptBinary struct {
	Value testtypes.Binary
	Set   bool
}

OptBinary is optional testtypes.Binary.

func NewOptBinary

func NewOptBinary(v testtypes.Binary) OptBinary

NewOptBinary returns new OptBinary with value set to v.

func (*OptBinary) Decode

func (o *OptBinary) Decode(d *jx.Decoder, format func(*jx.Decoder) (testtypes.Binary, error)) error

Decode decodes testtypes.Binary from json.

func (OptBinary) Encode

func (o OptBinary) Encode(e *jx.Encoder, format func(*jx.Encoder, testtypes.Binary))

Encode encodes testtypes.Binary as json.

func (OptBinary) Get

func (o OptBinary) Get() (v testtypes.Binary, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptBinary) IsSet

func (o OptBinary) IsSet() bool

IsSet returns true if OptBinary was set.

func (OptBinary) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptBinary) Or

Or returns value if set, or given parameter if does not.

func (*OptBinary) Reset

func (o *OptBinary) Reset()

Reset unsets value.

func (*OptBinary) SetTo

func (o *OptBinary) SetTo(v testtypes.Binary)

SetTo sets value to v.

func (*OptBinary) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptNumber

type OptNumber struct {
	Value testtypes.Number
	Set   bool
}

OptNumber is optional testtypes.Number.

func NewOptNumber

func NewOptNumber(v testtypes.Number) OptNumber

NewOptNumber returns new OptNumber with value set to v.

func (*OptNumber) Decode

func (o *OptNumber) Decode(d *jx.Decoder, format func(*jx.Decoder) (testtypes.Number, error)) error

Decode decodes testtypes.Number from json.

func (OptNumber) Encode

func (o OptNumber) Encode(e *jx.Encoder, format func(*jx.Encoder, testtypes.Number))

Encode encodes testtypes.Number as json.

func (OptNumber) Get

func (o OptNumber) Get() (v testtypes.Number, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptNumber) IsSet

func (o OptNumber) IsSet() bool

IsSet returns true if OptNumber was set.

func (OptNumber) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptNumber) Or

Or returns value if set, or given parameter if does not.

func (*OptNumber) Reset

func (o *OptNumber) Reset()

Reset unsets value.

func (*OptNumber) SetTo

func (o *OptNumber) SetTo(v testtypes.Number)

SetTo sets value to v.

func (*OptNumber) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptNumberJSON

type OptNumberJSON struct {
	Value testtypes.NumberJSON
	Set   bool
}

OptNumberJSON is optional testtypes.NumberJSON.

func NewOptNumberJSON

func NewOptNumberJSON(v testtypes.NumberJSON) OptNumberJSON

NewOptNumberJSON returns new OptNumberJSON with value set to v.

func (*OptNumberJSON) Decode

func (o *OptNumberJSON) Decode(d *jx.Decoder, format func(*jx.Decoder) (testtypes.NumberJSON, error)) error

Decode decodes testtypes.NumberJSON from json.

func (OptNumberJSON) Encode

func (o OptNumberJSON) Encode(e *jx.Encoder, format func(*jx.Encoder, testtypes.NumberJSON))

Encode encodes testtypes.NumberJSON as json.

func (OptNumberJSON) Get

func (o OptNumberJSON) Get() (v testtypes.NumberJSON, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptNumberJSON) IsSet

func (o OptNumberJSON) IsSet() bool

IsSet returns true if OptNumberJSON was set.

func (OptNumberJSON) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptNumberJSON) Or

Or returns value if set, or given parameter if does not.

func (*OptNumberJSON) Reset

func (o *OptNumberJSON) Reset()

Reset unsets value.

func (*OptNumberJSON) SetTo

func (o *OptNumberJSON) SetTo(v testtypes.NumberJSON)

SetTo sets value to v.

func (*OptNumberJSON) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptNumberOgen

type OptNumberOgen struct {
	Value testtypes.NumberOgen
	Set   bool
}

OptNumberOgen is optional testtypes.NumberOgen.

func NewOptNumberOgen

func NewOptNumberOgen(v testtypes.NumberOgen) OptNumberOgen

NewOptNumberOgen returns new OptNumberOgen with value set to v.

func (*OptNumberOgen) Decode

func (o *OptNumberOgen) Decode(d *jx.Decoder, format func(*jx.Decoder) (testtypes.NumberOgen, error)) error

Decode decodes testtypes.NumberOgen from json.

func (OptNumberOgen) Encode

func (o OptNumberOgen) Encode(e *jx.Encoder, format func(*jx.Encoder, testtypes.NumberOgen))

Encode encodes testtypes.NumberOgen as json.

func (OptNumberOgen) Get

func (o OptNumberOgen) Get() (v testtypes.NumberOgen, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptNumberOgen) IsSet

func (o OptNumberOgen) IsSet() bool

IsSet returns true if OptNumberOgen was set.

func (OptNumberOgen) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptNumberOgen) Or

Or returns value if set, or given parameter if does not.

func (*OptNumberOgen) Reset

func (o *OptNumberOgen) Reset()

Reset unsets value.

func (*OptNumberOgen) SetTo

func (o *OptNumberOgen) SetTo(v testtypes.NumberOgen)

SetTo sets value to v.

func (*OptNumberOgen) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptOptionalOKMap

type OptOptionalOKMap struct {
	Value OptionalOKMap
	Set   bool
}

OptOptionalOKMap is optional OptionalOKMap.

func NewOptOptionalOKMap

func NewOptOptionalOKMap(v OptionalOKMap) OptOptionalOKMap

NewOptOptionalOKMap returns new OptOptionalOKMap with value set to v.

func (*OptOptionalOKMap) Decode

func (o *OptOptionalOKMap) Decode(d *jx.Decoder) error

Decode decodes OptionalOKMap from json.

func (OptOptionalOKMap) Encode

func (o OptOptionalOKMap) Encode(e *jx.Encoder)

Encode encodes OptionalOKMap as json.

func (OptOptionalOKMap) Get

func (o OptOptionalOKMap) Get() (v OptionalOKMap, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptOptionalOKMap) IsSet

func (o OptOptionalOKMap) IsSet() bool

IsSet returns true if OptOptionalOKMap was set.

func (OptOptionalOKMap) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptOptionalOKMap) Or

Or returns value if set, or given parameter if does not.

func (*OptOptionalOKMap) Reset

func (o *OptOptionalOKMap) Reset()

Reset unsets value.

func (*OptOptionalOKMap) SetTo

func (o *OptOptionalOKMap) SetTo(v OptionalOKMap)

SetTo sets value to v.

func (*OptOptionalOKMap) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptPointer

type OptPointer struct {
	Value testtypes.NumberOgen
	Set   bool
}

OptPointer is optional testtypes.NumberOgen.

func NewOptPointer

func NewOptPointer(v testtypes.NumberOgen) OptPointer

NewOptPointer returns new OptPointer with value set to v.

func (*OptPointer) Decode

func (o *OptPointer) Decode(d *jx.Decoder, format func(*jx.Decoder) (testtypes.NumberOgen, error)) error

Decode decodes testtypes.NumberOgen from json.

func (OptPointer) Encode

func (o OptPointer) Encode(e *jx.Encoder, format func(*jx.Encoder, testtypes.NumberOgen))

Encode encodes testtypes.NumberOgen as json.

func (OptPointer) Get

func (o OptPointer) Get() (v testtypes.NumberOgen, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptPointer) IsSet

func (o OptPointer) IsSet() bool

IsSet returns true if OptPointer was set.

func (OptPointer) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptPointer) Or

Or returns value if set, or given parameter if does not.

func (*OptPointer) Reset

func (o *OptPointer) Reset()

Reset unsets value.

func (*OptPointer) SetTo

func (o *OptPointer) SetTo(v testtypes.NumberOgen)

SetTo sets value to v.

func (*OptPointer) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptString

type OptString struct {
	Value testtypes.String
	Set   bool
}

OptString is optional testtypes.String.

func NewOptString

func NewOptString(v testtypes.String) OptString

NewOptString returns new OptString with value set to v.

func (*OptString) Decode

func (o *OptString) Decode(d *jx.Decoder, format func(*jx.Decoder) (testtypes.String, error)) error

Decode decodes testtypes.String from json.

func (OptString) Encode

func (o OptString) Encode(e *jx.Encoder, format func(*jx.Encoder, testtypes.String))

Encode encodes testtypes.String as json.

func (OptString) Get

func (o OptString) Get() (v testtypes.String, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptString) IsSet

func (o OptString) IsSet() bool

IsSet returns true if OptString was set.

func (OptString) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptString) Or

Or returns value if set, or given parameter if does not.

func (*OptString) Reset

func (o *OptString) Reset()

Reset unsets value.

func (*OptString) SetTo

func (o *OptString) SetTo(v testtypes.String)

SetTo sets value to v.

func (*OptString) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptStringJSON

type OptStringJSON struct {
	Value testtypes.StringJSON
	Set   bool
}

OptStringJSON is optional testtypes.StringJSON.

func NewOptStringJSON

func NewOptStringJSON(v testtypes.StringJSON) OptStringJSON

NewOptStringJSON returns new OptStringJSON with value set to v.

func (*OptStringJSON) Decode

func (o *OptStringJSON) Decode(d *jx.Decoder, format func(*jx.Decoder) (testtypes.StringJSON, error)) error

Decode decodes testtypes.StringJSON from json.

func (OptStringJSON) Encode

func (o OptStringJSON) Encode(e *jx.Encoder, format func(*jx.Encoder, testtypes.StringJSON))

Encode encodes testtypes.StringJSON as json.

func (OptStringJSON) Get

func (o OptStringJSON) Get() (v testtypes.StringJSON, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptStringJSON) IsSet

func (o OptStringJSON) IsSet() bool

IsSet returns true if OptStringJSON was set.

func (OptStringJSON) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptStringJSON) Or

Or returns value if set, or given parameter if does not.

func (*OptStringJSON) Reset

func (o *OptStringJSON) Reset()

Reset unsets value.

func (*OptStringJSON) SetTo

func (o *OptStringJSON) SetTo(v testtypes.StringJSON)

SetTo sets value to v.

func (*OptStringJSON) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptStringOgen

type OptStringOgen struct {
	Value testtypes.StringOgen
	Set   bool
}

OptStringOgen is optional testtypes.StringOgen.

func NewOptStringOgen

func NewOptStringOgen(v testtypes.StringOgen) OptStringOgen

NewOptStringOgen returns new OptStringOgen with value set to v.

func (*OptStringOgen) Decode

func (o *OptStringOgen) Decode(d *jx.Decoder, format func(*jx.Decoder) (testtypes.StringOgen, error)) error

Decode decodes testtypes.StringOgen from json.

func (OptStringOgen) Encode

func (o OptStringOgen) Encode(e *jx.Encoder, format func(*jx.Encoder, testtypes.StringOgen))

Encode encodes testtypes.StringOgen as json.

func (OptStringOgen) Get

func (o OptStringOgen) Get() (v testtypes.StringOgen, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptStringOgen) IsSet

func (o OptStringOgen) IsSet() bool

IsSet returns true if OptStringOgen was set.

func (OptStringOgen) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptStringOgen) Or

Or returns value if set, or given parameter if does not.

func (*OptStringOgen) Reset

func (o *OptStringOgen) Reset()

Reset unsets value.

func (*OptStringOgen) SetTo

func (o *OptStringOgen) SetTo(v testtypes.StringOgen)

SetTo sets value to v.

func (*OptStringOgen) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptText

type OptText struct {
	Value testtypes.Text
	Set   bool
}

OptText is optional testtypes.Text.

func NewOptText

func NewOptText(v testtypes.Text) OptText

NewOptText returns new OptText with value set to v.

func (*OptText) Decode

func (o *OptText) Decode(d *jx.Decoder, format func(*jx.Decoder) (testtypes.Text, error)) error

Decode decodes testtypes.Text from json.

func (OptText) Encode

func (o OptText) Encode(e *jx.Encoder, format func(*jx.Encoder, testtypes.Text))

Encode encodes testtypes.Text as json.

func (OptText) Get

func (o OptText) Get() (v testtypes.Text, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptText) IsSet

func (o OptText) IsSet() bool

IsSet returns true if OptText was set.

func (OptText) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptText) Or

Or returns value if set, or given parameter if does not.

func (*OptText) Reset

func (o *OptText) Reset()

Reset unsets value.

func (*OptText) SetTo

func (o *OptText) SetTo(v testtypes.Text)

SetTo sets value to v.

func (*OptText) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type Option

type Option interface {
	ServerOption
	ClientOption
}

Option is config option.

func WithAttributes

func WithAttributes(attributes ...attribute.KeyValue) Option

WithAttributes specifies default otel attributes.

func WithMeterProvider

func WithMeterProvider(provider metric.MeterProvider) Option

WithMeterProvider specifies a meter provider to use for creating a meter.

If none is specified, the otel.GetMeterProvider() is used.

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) Option

WithTracerProvider specifies a tracer provider to use for creating a tracer.

If none is specified, the global provider is used.

type OptionalOK

type OptionalOK struct {
	OgenString   OptStringOgen          `json:"ogenString"`
	OgenNumber   OptNumberOgen          `json:"ogenNumber"`
	JsonString   OptStringJSON          `json:"jsonString"`
	JsonNumber   OptNumberJSON          `json:"jsonNumber"`
	TextString   OptText                `json:"textString"`
	TextNumber   OptText                `json:"textNumber"`
	BinaryByte   OptBinary              `json:"binaryByte"`
	BinaryBase64 OptBinary              `json:"binaryBase64"`
	String       OptString              `json:"string"`
	Number       OptNumber              `json:"number"`
	Alias        OptAlias               `json:"alias"`
	Pointer      OptPointer             `json:"pointer"`
	AliasPointer OptAliasPointer        `json:"aliasPointer"`
	Builtin      OptAny                 `json:"builtin"`
	Array        []testtypes.StringJSON `json:"array"`
	Map          OptOptionalOKMap       `json:"map"`
}

func (*OptionalOK) Decode

func (s *OptionalOK) Decode(d *jx.Decoder) error

Decode decodes OptionalOK from json.

func (*OptionalOK) Encode

func (s *OptionalOK) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*OptionalOK) GetAlias

func (s *OptionalOK) GetAlias() OptAlias

GetAlias returns the value of Alias.

func (*OptionalOK) GetAliasPointer

func (s *OptionalOK) GetAliasPointer() OptAliasPointer

GetAliasPointer returns the value of AliasPointer.

func (*OptionalOK) GetArray

func (s *OptionalOK) GetArray() []testtypes.StringJSON

GetArray returns the value of Array.

func (*OptionalOK) GetBinaryBase64

func (s *OptionalOK) GetBinaryBase64() OptBinary

GetBinaryBase64 returns the value of BinaryBase64.

func (*OptionalOK) GetBinaryByte

func (s *OptionalOK) GetBinaryByte() OptBinary

GetBinaryByte returns the value of BinaryByte.

func (*OptionalOK) GetBuiltin

func (s *OptionalOK) GetBuiltin() OptAny

GetBuiltin returns the value of Builtin.

func (*OptionalOK) GetJsonNumber

func (s *OptionalOK) GetJsonNumber() OptNumberJSON

GetJsonNumber returns the value of JsonNumber.

func (*OptionalOK) GetJsonString

func (s *OptionalOK) GetJsonString() OptStringJSON

GetJsonString returns the value of JsonString.

func (*OptionalOK) GetMap

func (s *OptionalOK) GetMap() OptOptionalOKMap

GetMap returns the value of Map.

func (*OptionalOK) GetNumber

func (s *OptionalOK) GetNumber() OptNumber

GetNumber returns the value of Number.

func (*OptionalOK) GetOgenNumber

func (s *OptionalOK) GetOgenNumber() OptNumberOgen

GetOgenNumber returns the value of OgenNumber.

func (*OptionalOK) GetOgenString

func (s *OptionalOK) GetOgenString() OptStringOgen

GetOgenString returns the value of OgenString.

func (*OptionalOK) GetPointer

func (s *OptionalOK) GetPointer() OptPointer

GetPointer returns the value of Pointer.

func (*OptionalOK) GetString

func (s *OptionalOK) GetString() OptString

GetString returns the value of String.

func (*OptionalOK) GetTextNumber

func (s *OptionalOK) GetTextNumber() OptText

GetTextNumber returns the value of TextNumber.

func (*OptionalOK) GetTextString

func (s *OptionalOK) GetTextString() OptText

GetTextString returns the value of TextString.

func (*OptionalOK) MarshalJSON

func (s *OptionalOK) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*OptionalOK) SetAlias

func (s *OptionalOK) SetAlias(val OptAlias)

SetAlias sets the value of Alias.

func (*OptionalOK) SetAliasPointer

func (s *OptionalOK) SetAliasPointer(val OptAliasPointer)

SetAliasPointer sets the value of AliasPointer.

func (*OptionalOK) SetArray

func (s *OptionalOK) SetArray(val []testtypes.StringJSON)

SetArray sets the value of Array.

func (*OptionalOK) SetBinaryBase64

func (s *OptionalOK) SetBinaryBase64(val OptBinary)

SetBinaryBase64 sets the value of BinaryBase64.

func (*OptionalOK) SetBinaryByte

func (s *OptionalOK) SetBinaryByte(val OptBinary)

SetBinaryByte sets the value of BinaryByte.

func (*OptionalOK) SetBuiltin

func (s *OptionalOK) SetBuiltin(val OptAny)

SetBuiltin sets the value of Builtin.

func (*OptionalOK) SetJsonNumber

func (s *OptionalOK) SetJsonNumber(val OptNumberJSON)

SetJsonNumber sets the value of JsonNumber.

func (*OptionalOK) SetJsonString

func (s *OptionalOK) SetJsonString(val OptStringJSON)

SetJsonString sets the value of JsonString.

func (*OptionalOK) SetMap

func (s *OptionalOK) SetMap(val OptOptionalOKMap)

SetMap sets the value of Map.

func (*OptionalOK) SetNumber

func (s *OptionalOK) SetNumber(val OptNumber)

SetNumber sets the value of Number.

func (*OptionalOK) SetOgenNumber

func (s *OptionalOK) SetOgenNumber(val OptNumberOgen)

SetOgenNumber sets the value of OgenNumber.

func (*OptionalOK) SetOgenString

func (s *OptionalOK) SetOgenString(val OptStringOgen)

SetOgenString sets the value of OgenString.

func (*OptionalOK) SetPointer

func (s *OptionalOK) SetPointer(val OptPointer)

SetPointer sets the value of Pointer.

func (*OptionalOK) SetString

func (s *OptionalOK) SetString(val OptString)

SetString sets the value of String.

func (*OptionalOK) SetTextNumber

func (s *OptionalOK) SetTextNumber(val OptText)

SetTextNumber sets the value of TextNumber.

func (*OptionalOK) SetTextString

func (s *OptionalOK) SetTextString(val OptText)

SetTextString sets the value of TextString.

func (*OptionalOK) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptionalOKMap

type OptionalOKMap map[string]testtypes.StringJSON

func (*OptionalOKMap) Decode

func (s *OptionalOKMap) Decode(d *jx.Decoder) error

Decode decodes OptionalOKMap from json.

func (OptionalOKMap) Encode

func (s OptionalOKMap) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (OptionalOKMap) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*OptionalOKMap) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptionalParams

type OptionalParams struct {
	OgenString   OptStringOgen          `json:",omitempty,omitzero"`
	OgenNumber   OptNumberOgen          `json:",omitempty,omitzero"`
	JsonString   OptStringJSON          `json:",omitempty,omitzero"`
	JsonNumber   OptNumberJSON          `json:",omitempty,omitzero"`
	TextString   OptText                `json:",omitempty,omitzero"`
	TextNumber   OptText                `json:",omitempty,omitzero"`
	BinaryByte   OptBinary              `json:",omitempty,omitzero"`
	BinaryBase64 OptBinary              `json:",omitempty,omitzero"`
	String       OptString              `json:",omitempty,omitzero"`
	Number       OptNumber              `json:",omitempty,omitzero"`
	Alias        OptAlias               `json:",omitempty,omitzero"`
	Pointer      OptPointer             `json:",omitempty,omitzero"`
	AliasPointer OptAliasPointer        `json:",omitempty,omitzero"`
	Array        []testtypes.StringJSON `json:",omitempty"`
}

OptionalParams is parameters of optional operation.

type RequiredOK

type RequiredOK struct {
	OgenString   testtypes.StringOgen   `json:"ogenString"`
	OgenNumber   testtypes.NumberOgen   `json:"ogenNumber"`
	JsonString   testtypes.StringJSON   `json:"jsonString"`
	JsonNumber   testtypes.NumberJSON   `json:"jsonNumber"`
	TextString   testtypes.Text         `json:"textString"`
	TextNumber   testtypes.Text         `json:"textNumber"`
	BinaryByte   testtypes.Binary       `json:"binaryByte"`
	BinaryBase64 testtypes.Binary       `json:"binaryBase64"`
	String       testtypes.String       `json:"string"`
	Number       testtypes.Number       `json:"number"`
	Alias        Alias                  `json:"alias"`
	Pointer      testtypes.NumberOgen   `json:"pointer"`
	AliasPointer AliasPointer           `json:"aliasPointer"`
	Builtin      any                    `json:"builtin"`
	Array        []testtypes.StringJSON `json:"array"`
	Map          RequiredOKMap          `json:"map"`
}

func (*RequiredOK) Decode

func (s *RequiredOK) Decode(d *jx.Decoder) error

Decode decodes RequiredOK from json.

func (*RequiredOK) Encode

func (s *RequiredOK) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*RequiredOK) GetAlias

func (s *RequiredOK) GetAlias() Alias

GetAlias returns the value of Alias.

func (*RequiredOK) GetAliasPointer

func (s *RequiredOK) GetAliasPointer() AliasPointer

GetAliasPointer returns the value of AliasPointer.

func (*RequiredOK) GetArray

func (s *RequiredOK) GetArray() []testtypes.StringJSON

GetArray returns the value of Array.

func (*RequiredOK) GetBinaryBase64

func (s *RequiredOK) GetBinaryBase64() testtypes.Binary

GetBinaryBase64 returns the value of BinaryBase64.

func (*RequiredOK) GetBinaryByte

func (s *RequiredOK) GetBinaryByte() testtypes.Binary

GetBinaryByte returns the value of BinaryByte.

func (*RequiredOK) GetBuiltin

func (s *RequiredOK) GetBuiltin() any

GetBuiltin returns the value of Builtin.

func (*RequiredOK) GetJsonNumber

func (s *RequiredOK) GetJsonNumber() testtypes.NumberJSON

GetJsonNumber returns the value of JsonNumber.

func (*RequiredOK) GetJsonString

func (s *RequiredOK) GetJsonString() testtypes.StringJSON

GetJsonString returns the value of JsonString.

func (*RequiredOK) GetMap

func (s *RequiredOK) GetMap() RequiredOKMap

GetMap returns the value of Map.

func (*RequiredOK) GetNumber

func (s *RequiredOK) GetNumber() testtypes.Number

GetNumber returns the value of Number.

func (*RequiredOK) GetOgenNumber

func (s *RequiredOK) GetOgenNumber() testtypes.NumberOgen

GetOgenNumber returns the value of OgenNumber.

func (*RequiredOK) GetOgenString

func (s *RequiredOK) GetOgenString() testtypes.StringOgen

GetOgenString returns the value of OgenString.

func (*RequiredOK) GetPointer

func (s *RequiredOK) GetPointer() testtypes.NumberOgen

GetPointer returns the value of Pointer.

func (*RequiredOK) GetString

func (s *RequiredOK) GetString() testtypes.String

GetString returns the value of String.

func (*RequiredOK) GetTextNumber

func (s *RequiredOK) GetTextNumber() testtypes.Text

GetTextNumber returns the value of TextNumber.

func (*RequiredOK) GetTextString

func (s *RequiredOK) GetTextString() testtypes.Text

GetTextString returns the value of TextString.

func (*RequiredOK) MarshalJSON

func (s *RequiredOK) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*RequiredOK) SetAlias

func (s *RequiredOK) SetAlias(val Alias)

SetAlias sets the value of Alias.

func (*RequiredOK) SetAliasPointer

func (s *RequiredOK) SetAliasPointer(val AliasPointer)

SetAliasPointer sets the value of AliasPointer.

func (*RequiredOK) SetArray

func (s *RequiredOK) SetArray(val []testtypes.StringJSON)

SetArray sets the value of Array.

func (*RequiredOK) SetBinaryBase64

func (s *RequiredOK) SetBinaryBase64(val testtypes.Binary)

SetBinaryBase64 sets the value of BinaryBase64.

func (*RequiredOK) SetBinaryByte

func (s *RequiredOK) SetBinaryByte(val testtypes.Binary)

SetBinaryByte sets the value of BinaryByte.

func (*RequiredOK) SetBuiltin

func (s *RequiredOK) SetBuiltin(val any)

SetBuiltin sets the value of Builtin.

func (*RequiredOK) SetJsonNumber

func (s *RequiredOK) SetJsonNumber(val testtypes.NumberJSON)

SetJsonNumber sets the value of JsonNumber.

func (*RequiredOK) SetJsonString

func (s *RequiredOK) SetJsonString(val testtypes.StringJSON)

SetJsonString sets the value of JsonString.

func (*RequiredOK) SetMap

func (s *RequiredOK) SetMap(val RequiredOKMap)

SetMap sets the value of Map.

func (*RequiredOK) SetNumber

func (s *RequiredOK) SetNumber(val testtypes.Number)

SetNumber sets the value of Number.

func (*RequiredOK) SetOgenNumber

func (s *RequiredOK) SetOgenNumber(val testtypes.NumberOgen)

SetOgenNumber sets the value of OgenNumber.

func (*RequiredOK) SetOgenString

func (s *RequiredOK) SetOgenString(val testtypes.StringOgen)

SetOgenString sets the value of OgenString.

func (*RequiredOK) SetPointer

func (s *RequiredOK) SetPointer(val testtypes.NumberOgen)

SetPointer sets the value of Pointer.

func (*RequiredOK) SetString

func (s *RequiredOK) SetString(val testtypes.String)

SetString sets the value of String.

func (*RequiredOK) SetTextNumber

func (s *RequiredOK) SetTextNumber(val testtypes.Text)

SetTextNumber sets the value of TextNumber.

func (*RequiredOK) SetTextString

func (s *RequiredOK) SetTextString(val testtypes.Text)

SetTextString sets the value of TextString.

func (*RequiredOK) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*RequiredOK) Validate

func (s *RequiredOK) Validate() error

type RequiredOKMap

type RequiredOKMap map[string]testtypes.StringJSON

func (*RequiredOKMap) Decode

func (s *RequiredOKMap) Decode(d *jx.Decoder) error

Decode decodes RequiredOKMap from json.

func (RequiredOKMap) Encode

func (s RequiredOKMap) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (RequiredOKMap) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*RequiredOKMap) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type RequiredParams

type RequiredParams struct {
	OgenString   testtypes.StringOgen
	OgenNumber   testtypes.NumberOgen
	JsonString   testtypes.StringJSON
	JsonNumber   testtypes.NumberJSON
	TextString   testtypes.Text
	TextNumber   testtypes.Text
	BinaryByte   testtypes.Binary
	BinaryBase64 testtypes.Binary
	String       testtypes.String
	Number       testtypes.Number
	Alias        Alias
	Pointer      testtypes.NumberOgen
	AliasPointer AliasPointer
	Array        []testtypes.StringJSON `json:",omitempty"`
}

RequiredParams is parameters of required operation.

type Route

type Route struct {
	// contains filtered or unexported fields
}

Route is route object.

func (Route) Args

func (r Route) Args() []string

Args returns parsed arguments.

func (Route) Name

func (r Route) Name() string

Name returns ogen operation name.

It is guaranteed to be unique and not empty.

func (Route) OperationGroup added in v1.17.0

func (r Route) OperationGroup() string

OperationGroup returns the x-ogen-operation-group value.

func (Route) OperationID

func (r Route) OperationID() string

OperationID returns OpenAPI operationId.

func (Route) PathPattern

func (r Route) PathPattern() string

PathPattern returns OpenAPI path.

func (Route) Summary

func (r Route) Summary() string

Summary returns OpenAPI summary.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server implements http server based on OpenAPI v3 specification and calls Handler to handle requests.

func NewServer

func NewServer(h Handler, opts ...ServerOption) (*Server, error)

NewServer creates new Server.

func (*Server) FindPath

func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool)

FindPath finds Route for given method and URL.

func (*Server) FindRoute

func (s *Server) FindRoute(method, path string) (Route, bool)

FindRoute finds Route for given method and path.

Note: this method does not unescape path or handle reserved characters in path properly. Use FindPath instead.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves http request as defined by OpenAPI v3 specification, calling handler that matches the path or returning not found error.

type ServerOption

type ServerOption interface {
	// contains filtered or unexported methods
}

ServerOption is server config option.

func WithErrorHandler

func WithErrorHandler(h ErrorHandler) ServerOption

WithErrorHandler specifies error handler to use.

func WithMaxMultipartMemory

func WithMaxMultipartMemory(max int64) ServerOption

WithMaxMultipartMemory specifies limit of memory for storing file parts. File parts which can't be stored in memory will be stored on disk in temporary files.

func WithMethodNotAllowed

func WithMethodNotAllowed(methodNotAllowed func(w http.ResponseWriter, r *http.Request, allowed string)) ServerOption

WithMethodNotAllowed specifies Method Not Allowed handler to use.

func WithMiddleware

func WithMiddleware(m ...Middleware) ServerOption

WithMiddleware specifies middlewares to use.

func WithNotFound

func WithNotFound(notFound http.HandlerFunc) ServerOption

WithNotFound specifies Not Found handler to use.

func WithPathPrefix

func WithPathPrefix(prefix string) ServerOption

WithPathPrefix specifies server path prefix.

type UnimplementedHandler

type UnimplementedHandler struct{}

UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.

func (UnimplementedHandler) Optional

func (UnimplementedHandler) Optional(ctx context.Context, params OptionalParams) (r *OptionalOK, _ error)

Optional implements optional operation.

GET /optional

func (UnimplementedHandler) Required

func (UnimplementedHandler) Required(ctx context.Context, params RequiredParams) (r *RequiredOK, _ error)

Required implements required operation.

GET /required

Jump to

Keyboard shortcuts

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