api

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 26 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	MediaTypeApplicationJSON string = "application/json"
)

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 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) Wrappers

func (c *Client) Wrappers(ctx context.Context, request *Wrappers) (*Wrappers, error)

Wrappers invokes wrappers operation.

POST /wrappers

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 {
	// Wrappers implements wrappers operation.
	//
	// POST /wrappers
	Wrappers(ctx context.Context, req *Wrappers) (*Wrappers, error)
}

Handler handles operations described by OpenAPI v3 specification.

type Invoker

type Invoker interface {
	// Wrappers invokes wrappers operation.
	//
	// POST /wrappers
	Wrappers(ctx context.Context, request *Wrappers) (*Wrappers, 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 Name

type Name string

func (*Name) Decode

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

Decode decodes Name from json.

func (Name) Encode

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

Encode encodes Name as json.

func (Name) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Name) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (Name) Validate

func (s Name) Validate() error

type NilNullableObject

type NilNullableObject struct {
	Value NullableObject
	Null  bool
}

NilNullableObject is nullable NullableObject.

func NewNilNullableObject

func NewNilNullableObject(v NullableObject) NilNullableObject

NewNilNullableObject returns new NilNullableObject with value set to v.

func NewNilNullableObjectFromPtr

func NewNilNullableObjectFromPtr(v *NullableObject) NilNullableObject

NewNilNullableObjectFromPtr returns new NilNullableObject with value set to *v.

A nil v is null.

func (*NilNullableObject) Decode

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

Decode decodes NullableObject from json.

func (NilNullableObject) Encode

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

Encode encodes NullableObject as json.

func (NilNullableObject) Get

func (o NilNullableObject) Get() (v NullableObject, ok bool)

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

func (NilNullableObject) IsNull

func (o NilNullableObject) IsNull() bool

IsNull returns true if value is Null.

func (NilNullableObject) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (NilNullableObject) Or

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

func (NilNullableObject) Ptr

Ptr returns a pointer to a copy of the value, or nil if the value is null.

func (*NilNullableObject) SetTo

func (o *NilNullableObject) SetTo(v NullableObject)

SetTo sets value to v.

func (*NilNullableObject) SetToNull

func (o *NilNullableObject) SetToNull()

SetToNull sets value to null.

func (*NilNullableObject) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type NilString

type NilString struct {
	Value string
	Null  bool
}

NilString is nullable string.

func NewNilString

func NewNilString(v string) NilString

NewNilString returns new NilString with value set to v.

func NewNilStringFromPtr

func NewNilStringFromPtr(v *string) NilString

NewNilStringFromPtr returns new NilString with value set to *v.

A nil v is null.

func (*NilString) Decode

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

Decode decodes string from json.

func (NilString) Encode

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

Encode encodes string as json.

func (NilString) Get

func (o NilString) Get() (v string, ok bool)

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

func (NilString) IsNull

func (o NilString) IsNull() bool

IsNull returns true if value is Null.

func (NilString) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (NilString) Or

func (o NilString) Or(d string) string

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

func (NilString) Ptr

func (o NilString) Ptr() *string

Ptr returns a pointer to a copy of the value, or nil if the value is null.

func (*NilString) SetTo

func (o *NilString) SetTo(v string)

SetTo sets value to v.

func (*NilString) SetToNull

func (o *NilString) SetToNull()

SetToNull sets value to null.

func (*NilString) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type NullableObject

type NullableObject struct {
	ID int `json:"id"`
}

Ref: #/components/schemas/NullableObject

func (*NullableObject) Decode

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

Decode decodes NullableObject from json.

func (*NullableObject) Encode

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

Encode implements json.Marshaler.

func (*NullableObject) GetID

func (s *NullableObject) GetID() int

GetID returns the value of ID.

func (*NullableObject) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*NullableObject) SetID

func (s *NullableObject) SetID(val int)

SetID sets the value of ID.

func (*NullableObject) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type Object

type Object struct {
	ID int `json:"id"`
}

Ref: #/components/schemas/Object

func (*Object) Decode

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

Decode decodes Object from json.

func (*Object) Encode

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

Encode implements json.Marshaler.

func (*Object) GetID

func (s *Object) GetID() int

GetID returns the value of ID.

func (*Object) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Object) SetID

func (s *Object) SetID(val int)

SetID sets the value of ID.

func (*Object) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OperationName

type OperationName = string

OperationName is the ogen operation name

const (
	WrappersOperation OperationName = "Wrappers"
)

type OptDateTime

type OptDateTime struct {
	Value time.Time
	Set   bool
}

OptDateTime is optional time.Time.

func NewOptDateTime

func NewOptDateTime(v time.Time) OptDateTime

NewOptDateTime returns new OptDateTime with value set to v.

func NewOptDateTimeFromPtr

func NewOptDateTimeFromPtr(v *time.Time) OptDateTime

NewOptDateTimeFromPtr returns new OptDateTime with value set to *v.

A nil v is not set.

func (*OptDateTime) Decode

func (o *OptDateTime) Decode(d *jx.Decoder, format func(*jx.Decoder) (time.Time, error)) error

Decode decodes time.Time from json.

func (OptDateTime) Encode

func (o OptDateTime) Encode(e *jx.Encoder, format func(*jx.Encoder, time.Time))

Encode encodes time.Time as json.

func (OptDateTime) Get

func (o OptDateTime) Get() (v time.Time, ok bool)

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

func (OptDateTime) IsSet

func (o OptDateTime) IsSet() bool

IsSet returns true if OptDateTime was set.

func (OptDateTime) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptDateTime) Or

func (o OptDateTime) Or(d time.Time) time.Time

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

func (OptDateTime) Ptr

func (o OptDateTime) Ptr() *time.Time

Ptr returns a pointer to a copy of the value, or nil if the value is not set.

func (*OptDateTime) Reset

func (o *OptDateTime) Reset()

Reset unsets value.

func (*OptDateTime) SetTo

func (o *OptDateTime) SetTo(v time.Time)

SetTo sets value to v.

func (*OptDateTime) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptInt64

type OptInt64 struct {
	Value int64
	Set   bool
}

OptInt64 is optional int64.

func NewOptInt64

func NewOptInt64(v int64) OptInt64

NewOptInt64 returns new OptInt64 with value set to v.

func NewOptInt64FromPtr

func NewOptInt64FromPtr(v *int64) OptInt64

NewOptInt64FromPtr returns new OptInt64 with value set to *v.

A nil v is not set.

func (*OptInt64) Decode

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

Decode decodes int64 from json.

func (OptInt64) Encode

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

Encode encodes int64 as json.

func (OptInt64) Get

func (o OptInt64) Get() (v int64, ok bool)

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

func (OptInt64) IsSet

func (o OptInt64) IsSet() bool

IsSet returns true if OptInt64 was set.

func (OptInt64) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptInt64) Or

func (o OptInt64) Or(d int64) int64

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

func (OptInt64) Ptr

func (o OptInt64) Ptr() *int64

Ptr returns a pointer to a copy of the value, or nil if the value is not set.

func (*OptInt64) Reset

func (o *OptInt64) Reset()

Reset unsets value.

func (*OptInt64) SetTo

func (o *OptInt64) SetTo(v int64)

SetTo sets value to v.

func (*OptInt64) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptName

type OptName struct {
	Value Name
	Set   bool
}

OptName is optional Name.

func NewOptName

func NewOptName(v Name) OptName

NewOptName returns new OptName with value set to v.

func NewOptNameFromPtr

func NewOptNameFromPtr(v *Name) OptName

NewOptNameFromPtr returns new OptName with value set to *v.

A nil v is not set.

func (*OptName) Decode

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

Decode decodes Name from json.

func (OptName) Encode

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

Encode encodes Name as json.

func (OptName) Get

func (o OptName) Get() (v Name, ok bool)

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

func (OptName) IsSet

func (o OptName) IsSet() bool

IsSet returns true if OptName was set.

func (OptName) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptName) Or

func (o OptName) Or(d Name) Name

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

func (OptName) Ptr

func (o OptName) Ptr() *Name

Ptr returns a pointer to a copy of the value, or nil if the value is not set.

func (*OptName) Reset

func (o *OptName) Reset()

Reset unsets value.

func (*OptName) SetTo

func (o *OptName) SetTo(v Name)

SetTo sets value to v.

func (*OptName) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptNilString

type OptNilString struct {
	Value string
	Set   bool
	Null  bool
}

OptNilString is optional nullable string.

func NewOptNilString

func NewOptNilString(v string) OptNilString

NewOptNilString returns new OptNilString with value set to v.

func NewOptNilStringFromPtr

func NewOptNilStringFromPtr(v *string) OptNilString

NewOptNilStringFromPtr returns new OptNilString with value set to *v.

A nil v is an explicit null: the result is set and null. Use the zero OptNilString for a value omitted from the payload.

func (*OptNilString) Decode

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

Decode decodes string from json.

func (OptNilString) Encode

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

Encode encodes string as json.

func (OptNilString) Get

func (o OptNilString) Get() (v string, ok bool)

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

func (OptNilString) IsEmpty

func (o OptNilString) IsEmpty() bool

IsEmpty returns true if the field was omitted from the payload (not Set and not Null).

func (OptNilString) IsNull

func (o OptNilString) IsNull() bool

IsNull returns true if value is Null.

func (OptNilString) IsSet

func (o OptNilString) IsSet() bool

IsSet returns true if OptNilString was set.

func (OptNilString) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptNilString) Or

func (o OptNilString) Or(d string) string

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

func (OptNilString) Ptr

func (o OptNilString) Ptr() *string

Ptr returns a pointer to a copy of the value, or nil if the value is not set or is null.

func (*OptNilString) Reset

func (o *OptNilString) Reset()

Reset unsets value.

func (*OptNilString) SetTo

func (o *OptNilString) SetTo(v string)

SetTo sets value to v.

func (*OptNilString) SetToNull

func (o *OptNilString) SetToNull()

SetToNull sets value to null.

func (*OptNilString) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptNilStringArray

type OptNilStringArray struct {
	Value []string
	Set   bool
	Null  bool
}

OptNilStringArray is optional nullable []string.

func NewOptNilStringArray

func NewOptNilStringArray(v []string) OptNilStringArray

NewOptNilStringArray returns new OptNilStringArray with value set to v.

func NewOptNilStringArrayFromPtr

func NewOptNilStringArrayFromPtr(v *[]string) OptNilStringArray

NewOptNilStringArrayFromPtr returns new OptNilStringArray with value set to *v.

A nil v is an explicit null: the result is set and null. Use the zero OptNilStringArray for a value omitted from the payload.

func (*OptNilStringArray) Decode

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

Decode decodes []string from json.

func (OptNilStringArray) Encode

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

Encode encodes []string as json.

func (OptNilStringArray) Get

func (o OptNilStringArray) Get() (v []string, ok bool)

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

func (OptNilStringArray) IsEmpty

func (o OptNilStringArray) IsEmpty() bool

IsEmpty returns true if the field was omitted from the payload (not Set and not Null).

func (OptNilStringArray) IsNull

func (o OptNilStringArray) IsNull() bool

IsNull returns true if value is Null.

func (OptNilStringArray) IsSet

func (o OptNilStringArray) IsSet() bool

IsSet returns true if OptNilStringArray was set.

func (OptNilStringArray) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptNilStringArray) Or

func (o OptNilStringArray) Or(d []string) []string

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

func (OptNilStringArray) Ptr

func (o OptNilStringArray) Ptr() *[]string

Ptr returns a pointer to a copy of the value, or nil if the value is not set or is null.

func (*OptNilStringArray) Reset

func (o *OptNilStringArray) Reset()

Reset unsets value.

func (*OptNilStringArray) SetTo

func (o *OptNilStringArray) SetTo(v []string)

SetTo sets value to v.

func (*OptNilStringArray) SetToNull

func (o *OptNilStringArray) SetToNull()

SetToNull sets value to null.

func (*OptNilStringArray) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptObject

type OptObject struct {
	Value Object
	Set   bool
}

OptObject is optional Object.

func NewOptObject

func NewOptObject(v Object) OptObject

NewOptObject returns new OptObject with value set to v.

func NewOptObjectFromPtr

func NewOptObjectFromPtr(v *Object) OptObject

NewOptObjectFromPtr returns new OptObject with value set to *v.

A nil v is not set.

func (*OptObject) Decode

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

Decode decodes Object from json.

func (OptObject) Encode

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

Encode encodes Object as json.

func (OptObject) Get

func (o OptObject) Get() (v Object, ok bool)

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

func (OptObject) IsSet

func (o OptObject) IsSet() bool

IsSet returns true if OptObject was set.

func (OptObject) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptObject) Or

func (o OptObject) Or(d Object) Object

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

func (OptObject) Ptr

func (o OptObject) Ptr() *Object

Ptr returns a pointer to a copy of the value, or nil if the value is not set.

func (*OptObject) Reset

func (o *OptObject) Reset()

Reset unsets value.

func (*OptObject) SetTo

func (o *OptObject) SetTo(v Object)

SetTo sets value to v.

func (*OptObject) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptString

type OptString struct {
	Value string
	Set   bool
}

OptString is optional string.

func NewOptString

func NewOptString(v string) OptString

NewOptString returns new OptString with value set to v.

func NewOptStringFromPtr

func NewOptStringFromPtr(v *string) OptString

NewOptStringFromPtr returns new OptString with value set to *v.

A nil v is not set.

func (*OptString) Decode

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

Decode decodes string from json.

func (OptString) Encode

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

Encode encodes string as json.

func (OptString) Get

func (o OptString) Get() (v 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

func (o OptString) Or(d string) string

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

func (OptString) Ptr

func (o OptString) Ptr() *string

Ptr returns a pointer to a copy of the value, or nil if the value is not set.

func (*OptString) Reset

func (o *OptString) Reset()

Reset unsets value.

func (*OptString) SetTo

func (o *OptString) SetTo(v string)

SetTo sets value to v.

func (*OptString) UnmarshalJSON

func (s *OptString) 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 NewOptStringOgenFromPtr

func NewOptStringOgenFromPtr(v *testtypes.StringOgen) OptStringOgen

NewOptStringOgenFromPtr returns new OptStringOgen with value set to *v.

A nil v is not set.

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) Ptr

Ptr returns a pointer to a copy of the value, or nil if the value is not set.

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

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) Wrappers

func (UnimplementedHandler) Wrappers(ctx context.Context, req *Wrappers) (r *Wrappers, _ error)

Wrappers implements wrappers operation.

POST /wrappers

type Wrappers

type Wrappers struct {
	OptString    OptString         `json:"optString"`
	NilString    NilString         `json:"nilString"`
	OptNilString OptNilString      `json:"optNilString"`
	OptInt       OptInt64          `json:"optInt"`
	OptTime      OptDateTime       `json:"optTime"`
	OptName      OptName           `json:"optName"`
	OptObject    OptObject         `json:"optObject"`
	NilObject    NilNullableObject `json:"nilObject"`
	OptNilArray  OptNilStringArray `json:"optNilArray"`
	OptExternal  OptStringOgen     `json:"optExternal"`
}

Ref: #/components/schemas/Wrappers

func (*Wrappers) Decode

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

Decode decodes Wrappers from json.

func (*Wrappers) Encode

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

Encode implements json.Marshaler.

func (*Wrappers) GetNilObject

func (s *Wrappers) GetNilObject() NilNullableObject

GetNilObject returns the value of NilObject.

func (*Wrappers) GetNilString

func (s *Wrappers) GetNilString() NilString

GetNilString returns the value of NilString.

func (*Wrappers) GetOptExternal

func (s *Wrappers) GetOptExternal() OptStringOgen

GetOptExternal returns the value of OptExternal.

func (*Wrappers) GetOptInt

func (s *Wrappers) GetOptInt() OptInt64

GetOptInt returns the value of OptInt.

func (*Wrappers) GetOptName

func (s *Wrappers) GetOptName() OptName

GetOptName returns the value of OptName.

func (*Wrappers) GetOptNilArray

func (s *Wrappers) GetOptNilArray() OptNilStringArray

GetOptNilArray returns the value of OptNilArray.

func (*Wrappers) GetOptNilString

func (s *Wrappers) GetOptNilString() OptNilString

GetOptNilString returns the value of OptNilString.

func (*Wrappers) GetOptObject

func (s *Wrappers) GetOptObject() OptObject

GetOptObject returns the value of OptObject.

func (*Wrappers) GetOptString

func (s *Wrappers) GetOptString() OptString

GetOptString returns the value of OptString.

func (*Wrappers) GetOptTime

func (s *Wrappers) GetOptTime() OptDateTime

GetOptTime returns the value of OptTime.

func (*Wrappers) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Wrappers) SetNilObject

func (s *Wrappers) SetNilObject(val NilNullableObject)

SetNilObject sets the value of NilObject.

func (*Wrappers) SetNilString

func (s *Wrappers) SetNilString(val NilString)

SetNilString sets the value of NilString.

func (*Wrappers) SetOptExternal

func (s *Wrappers) SetOptExternal(val OptStringOgen)

SetOptExternal sets the value of OptExternal.

func (*Wrappers) SetOptInt

func (s *Wrappers) SetOptInt(val OptInt64)

SetOptInt sets the value of OptInt.

func (*Wrappers) SetOptName

func (s *Wrappers) SetOptName(val OptName)

SetOptName sets the value of OptName.

func (*Wrappers) SetOptNilArray

func (s *Wrappers) SetOptNilArray(val OptNilStringArray)

SetOptNilArray sets the value of OptNilArray.

func (*Wrappers) SetOptNilString

func (s *Wrappers) SetOptNilString(val OptNilString)

SetOptNilString sets the value of OptNilString.

func (*Wrappers) SetOptObject

func (s *Wrappers) SetOptObject(val OptObject)

SetOptObject sets the value of OptObject.

func (*Wrappers) SetOptString

func (s *Wrappers) SetOptString(val OptString)

SetOptString sets the value of OptString.

func (*Wrappers) SetOptTime

func (s *Wrappers) SetOptTime(val OptDateTime)

SetOptTime sets the value of OptTime.

func (*Wrappers) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*Wrappers) Validate

func (s *Wrappers) Validate() error

Jump to

Keyboard shortcuts

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