stdhttp

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package stdhttp contains the std-http server for the parameter roundtrip test.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOpenAPISpecJSON

func GetOpenAPISpecJSON() ([]byte, error)

GetOpenAPISpecJSON returns the raw OpenAPI spec as JSON bytes.

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, m ServeMux) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler

HandlerFromMuxWithBaseURL creates http.Handler with routing and a base URL.

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options.

Types

type ComplexObject

type ComplexObject struct {
	Object  Object `form:"Object" json:"Object"`
	ID      int    `form:"Id" json:"Id"`
	IsAdmin bool   `form:"IsAdmin" json:"IsAdmin"`
}

#/components/schemas/ComplexObject

func (*ComplexObject) ApplyDefaults

func (s *ComplexObject) ApplyDefaults()

ApplyDefaults sets default values for fields that are nil.

type GetCookieParams

type GetCookieParams struct {
	// p (cookie)
	P *int32
	// ep (cookie)
	Ep *int32
	// ea (cookie)
	Ea *[]int32
	// a (cookie)
	A *[]int32
	// eo (cookie)
	Eo *Object
	// o (cookie)
	O *Object
	// co (cookie)
	Co *string
}

GetCookieParams defines parameters for GetCookie.

type GetDeepObjectParams

type GetDeepObjectParams struct {
	// deepObj (required)
	DeepObj ComplexObject `form:"deepObj" json:"deepObj"`
}

GetDeepObjectParams defines parameters for GetDeepObject.

type GetHeaderParams

type GetHeaderParams struct {
	// X-Primitive (header)
	XPrimitive *int32
	// X-Primitive-Exploded (header)
	XPrimitiveExploded *int32
	// X-Array-Exploded (header)
	XArrayExploded *[]int32
	// X-Array (header)
	XArray *[]int32
	// X-Object-Exploded (header)
	XObjectExploded *Object
	// X-Object (header)
	XObject *Object
	// X-Complex-Object (header)
	XComplexObject *string
}

GetHeaderParams defines parameters for GetHeader.

type GetQueryFormParams

type GetQueryFormParams struct {
	// ea (optional)
	Ea *[]int32 `form:"ea" json:"ea"`
	// a (optional)
	A *[]int32 `form:"a" json:"a"`
	// eo (optional)
	Eo *Object `form:"eo" json:"eo"`
	// o (optional)
	O *Object `form:"o" json:"o"`
	// ep (optional)
	Ep *int32 `form:"ep" json:"ep"`
	// p (optional)
	P *int32 `form:"p" json:"p"`
	// ps (optional)
	Ps *string `form:"ps" json:"ps"`
	// co (optional)
	Co *string `form:"co" json:"co"`
}

GetQueryFormParams defines parameters for GetQueryForm.

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

InvalidParamFormatError is returned when a parameter has an invalid format.

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

MiddlewareFunc is a middleware function type.

type Object

type Object struct {
	Role      string `form:"role" json:"role"`
	FirstName string `form:"firstName" json:"firstName"`
}

#/components/schemas/Object

func (*Object) ApplyDefaults

func (s *Object) ApplyDefaults()

ApplyDefaults sets default values for fields that are nil.

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

RequiredHeaderError is returned when a required header is missing.

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

RequiredParamError is returned when a required parameter is missing.

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type ServeMux

type ServeMux interface {
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
	ServeHTTP(w http.ResponseWriter, r *http.Request)
}

ServeMux is an abstraction of http.ServeMux.

type Server

type Server struct{}

Server implements ServerInterface by echoing received parameters back as JSON.

func (*Server) GetContentObject

func (s *Server) GetContentObject(w http.ResponseWriter, r *http.Request, param string)

func (*Server) GetCookie

func (s *Server) GetCookie(w http.ResponseWriter, r *http.Request, params GetCookieParams)

func (*Server) GetDeepObject

func (s *Server) GetDeepObject(w http.ResponseWriter, r *http.Request, params GetDeepObjectParams)

func (*Server) GetHeader

func (s *Server) GetHeader(w http.ResponseWriter, r *http.Request, params GetHeaderParams)

func (*Server) GetLabelExplodeArray

func (s *Server) GetLabelExplodeArray(w http.ResponseWriter, r *http.Request, param []int32)

func (*Server) GetLabelExplodeObject

func (s *Server) GetLabelExplodeObject(w http.ResponseWriter, r *http.Request, param Object)

func (*Server) GetLabelExplodePrimitive

func (s *Server) GetLabelExplodePrimitive(w http.ResponseWriter, r *http.Request, param int32)

func (*Server) GetLabelNoExplodeArray

func (s *Server) GetLabelNoExplodeArray(w http.ResponseWriter, r *http.Request, param []int32)

func (*Server) GetLabelNoExplodeObject

func (s *Server) GetLabelNoExplodeObject(w http.ResponseWriter, r *http.Request, param Object)

func (*Server) GetLabelPrimitive

func (s *Server) GetLabelPrimitive(w http.ResponseWriter, r *http.Request, param int32)

func (*Server) GetMatrixExplodeArray

func (s *Server) GetMatrixExplodeArray(w http.ResponseWriter, r *http.Request, id []int32)

func (*Server) GetMatrixExplodeObject

func (s *Server) GetMatrixExplodeObject(w http.ResponseWriter, r *http.Request, id Object)

func (*Server) GetMatrixExplodePrimitive

func (s *Server) GetMatrixExplodePrimitive(w http.ResponseWriter, r *http.Request, id int32)

func (*Server) GetMatrixNoExplodeArray

func (s *Server) GetMatrixNoExplodeArray(w http.ResponseWriter, r *http.Request, id []int32)

func (*Server) GetMatrixNoExplodeObject

func (s *Server) GetMatrixNoExplodeObject(w http.ResponseWriter, r *http.Request, id Object)

func (*Server) GetMatrixPrimitive

func (s *Server) GetMatrixPrimitive(w http.ResponseWriter, r *http.Request, id int32)

func (*Server) GetPassThrough

func (s *Server) GetPassThrough(w http.ResponseWriter, r *http.Request, param string)

func (*Server) GetQueryForm

func (s *Server) GetQueryForm(w http.ResponseWriter, r *http.Request, params GetQueryFormParams)

func (*Server) GetSimpleExplodeArray

func (s *Server) GetSimpleExplodeArray(w http.ResponseWriter, r *http.Request, param []int32)

func (*Server) GetSimpleExplodeObject

func (s *Server) GetSimpleExplodeObject(w http.ResponseWriter, r *http.Request, param Object)

func (*Server) GetSimpleExplodePrimitive

func (s *Server) GetSimpleExplodePrimitive(w http.ResponseWriter, r *http.Request, param int32)

func (*Server) GetSimpleNoExplodeArray

func (s *Server) GetSimpleNoExplodeArray(w http.ResponseWriter, r *http.Request, param []int32)

func (*Server) GetSimpleNoExplodeObject

func (s *Server) GetSimpleNoExplodeObject(w http.ResponseWriter, r *http.Request, param Object)

func (*Server) GetSimplePrimitive

func (s *Server) GetSimplePrimitive(w http.ResponseWriter, r *http.Request, param int32)

type ServerInterface

type ServerInterface interface {

	// (GET /contentObject/{param})
	GetContentObject(w http.ResponseWriter, r *http.Request, param string)

	// (GET /cookie)
	GetCookie(w http.ResponseWriter, r *http.Request, params GetCookieParams)

	// (GET /header)
	GetHeader(w http.ResponseWriter, r *http.Request, params GetHeaderParams)

	// (GET /labelExplodeArray/{.param*})
	GetLabelExplodeArray(w http.ResponseWriter, r *http.Request, param []int32)

	// (GET /labelExplodeObject/{.param*})
	GetLabelExplodeObject(w http.ResponseWriter, r *http.Request, param Object)

	// (GET /labelExplodePrimitive/{.param*})
	GetLabelExplodePrimitive(w http.ResponseWriter, r *http.Request, param int32)

	// (GET /labelNoExplodeArray/{.param})
	GetLabelNoExplodeArray(w http.ResponseWriter, r *http.Request, param []int32)

	// (GET /labelNoExplodeObject/{.param})
	GetLabelNoExplodeObject(w http.ResponseWriter, r *http.Request, param Object)

	// (GET /labelPrimitive/{.param})
	GetLabelPrimitive(w http.ResponseWriter, r *http.Request, param int32)

	// (GET /matrixExplodeArray/{.id*})
	GetMatrixExplodeArray(w http.ResponseWriter, r *http.Request, id []int32)

	// (GET /matrixExplodeObject/{.id*})
	GetMatrixExplodeObject(w http.ResponseWriter, r *http.Request, id Object)

	// (GET /matrixExplodePrimitive/{;id*})
	GetMatrixExplodePrimitive(w http.ResponseWriter, r *http.Request, id int32)

	// (GET /matrixNoExplodeArray/{.id})
	GetMatrixNoExplodeArray(w http.ResponseWriter, r *http.Request, id []int32)

	// (GET /matrixNoExplodeObject/{.id})
	GetMatrixNoExplodeObject(w http.ResponseWriter, r *http.Request, id Object)

	// (GET /matrixPrimitive/{;id})
	GetMatrixPrimitive(w http.ResponseWriter, r *http.Request, id int32)

	// (GET /passThrough/{param})
	GetPassThrough(w http.ResponseWriter, r *http.Request, param string)

	// (GET /queryDeepObject)
	GetDeepObject(w http.ResponseWriter, r *http.Request, params GetDeepObjectParams)

	// (GET /queryForm)
	GetQueryForm(w http.ResponseWriter, r *http.Request, params GetQueryFormParams)

	// (GET /simpleExplodeArray/{param*})
	GetSimpleExplodeArray(w http.ResponseWriter, r *http.Request, param []int32)

	// (GET /simpleExplodeObject/{param*})
	GetSimpleExplodeObject(w http.ResponseWriter, r *http.Request, param Object)

	// (GET /simpleExplodePrimitive/{param})
	GetSimpleExplodePrimitive(w http.ResponseWriter, r *http.Request, param int32)

	// (GET /simpleNoExplodeArray/{param})
	GetSimpleNoExplodeArray(w http.ResponseWriter, r *http.Request, param []int32)

	// (GET /simpleNoExplodeObject/{param})
	GetSimpleNoExplodeObject(w http.ResponseWriter, r *http.Request, param Object)

	// (GET /simplePrimitive/{param})
	GetSimplePrimitive(w http.ResponseWriter, r *http.Request, param int32)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts HTTP requests to parameters.

func (*ServerInterfaceWrapper) GetContentObject

func (siw *ServerInterfaceWrapper) GetContentObject(w http.ResponseWriter, r *http.Request)

GetContentObject operation middleware

func (*ServerInterfaceWrapper) GetCookie

func (siw *ServerInterfaceWrapper) GetCookie(w http.ResponseWriter, r *http.Request)

GetCookie operation middleware

func (*ServerInterfaceWrapper) GetDeepObject

func (siw *ServerInterfaceWrapper) GetDeepObject(w http.ResponseWriter, r *http.Request)

GetDeepObject operation middleware

func (*ServerInterfaceWrapper) GetHeader

func (siw *ServerInterfaceWrapper) GetHeader(w http.ResponseWriter, r *http.Request)

GetHeader operation middleware

func (*ServerInterfaceWrapper) GetLabelExplodeArray

func (siw *ServerInterfaceWrapper) GetLabelExplodeArray(w http.ResponseWriter, r *http.Request)

GetLabelExplodeArray operation middleware

func (*ServerInterfaceWrapper) GetLabelExplodeObject

func (siw *ServerInterfaceWrapper) GetLabelExplodeObject(w http.ResponseWriter, r *http.Request)

GetLabelExplodeObject operation middleware

func (*ServerInterfaceWrapper) GetLabelExplodePrimitive

func (siw *ServerInterfaceWrapper) GetLabelExplodePrimitive(w http.ResponseWriter, r *http.Request)

GetLabelExplodePrimitive operation middleware

func (*ServerInterfaceWrapper) GetLabelNoExplodeArray

func (siw *ServerInterfaceWrapper) GetLabelNoExplodeArray(w http.ResponseWriter, r *http.Request)

GetLabelNoExplodeArray operation middleware

func (*ServerInterfaceWrapper) GetLabelNoExplodeObject

func (siw *ServerInterfaceWrapper) GetLabelNoExplodeObject(w http.ResponseWriter, r *http.Request)

GetLabelNoExplodeObject operation middleware

func (*ServerInterfaceWrapper) GetLabelPrimitive

func (siw *ServerInterfaceWrapper) GetLabelPrimitive(w http.ResponseWriter, r *http.Request)

GetLabelPrimitive operation middleware

func (*ServerInterfaceWrapper) GetMatrixExplodeArray

func (siw *ServerInterfaceWrapper) GetMatrixExplodeArray(w http.ResponseWriter, r *http.Request)

GetMatrixExplodeArray operation middleware

func (*ServerInterfaceWrapper) GetMatrixExplodeObject

func (siw *ServerInterfaceWrapper) GetMatrixExplodeObject(w http.ResponseWriter, r *http.Request)

GetMatrixExplodeObject operation middleware

func (*ServerInterfaceWrapper) GetMatrixExplodePrimitive

func (siw *ServerInterfaceWrapper) GetMatrixExplodePrimitive(w http.ResponseWriter, r *http.Request)

GetMatrixExplodePrimitive operation middleware

func (*ServerInterfaceWrapper) GetMatrixNoExplodeArray

func (siw *ServerInterfaceWrapper) GetMatrixNoExplodeArray(w http.ResponseWriter, r *http.Request)

GetMatrixNoExplodeArray operation middleware

func (*ServerInterfaceWrapper) GetMatrixNoExplodeObject

func (siw *ServerInterfaceWrapper) GetMatrixNoExplodeObject(w http.ResponseWriter, r *http.Request)

GetMatrixNoExplodeObject operation middleware

func (*ServerInterfaceWrapper) GetMatrixPrimitive

func (siw *ServerInterfaceWrapper) GetMatrixPrimitive(w http.ResponseWriter, r *http.Request)

GetMatrixPrimitive operation middleware

func (*ServerInterfaceWrapper) GetPassThrough

func (siw *ServerInterfaceWrapper) GetPassThrough(w http.ResponseWriter, r *http.Request)

GetPassThrough operation middleware

func (*ServerInterfaceWrapper) GetQueryForm

func (siw *ServerInterfaceWrapper) GetQueryForm(w http.ResponseWriter, r *http.Request)

GetQueryForm operation middleware

func (*ServerInterfaceWrapper) GetSimpleExplodeArray

func (siw *ServerInterfaceWrapper) GetSimpleExplodeArray(w http.ResponseWriter, r *http.Request)

GetSimpleExplodeArray operation middleware

func (*ServerInterfaceWrapper) GetSimpleExplodeObject

func (siw *ServerInterfaceWrapper) GetSimpleExplodeObject(w http.ResponseWriter, r *http.Request)

GetSimpleExplodeObject operation middleware

func (*ServerInterfaceWrapper) GetSimpleExplodePrimitive

func (siw *ServerInterfaceWrapper) GetSimpleExplodePrimitive(w http.ResponseWriter, r *http.Request)

GetSimpleExplodePrimitive operation middleware

func (*ServerInterfaceWrapper) GetSimpleNoExplodeArray

func (siw *ServerInterfaceWrapper) GetSimpleNoExplodeArray(w http.ResponseWriter, r *http.Request)

GetSimpleNoExplodeArray operation middleware

func (*ServerInterfaceWrapper) GetSimpleNoExplodeObject

func (siw *ServerInterfaceWrapper) GetSimpleNoExplodeObject(w http.ResponseWriter, r *http.Request)

GetSimpleNoExplodeObject operation middleware

func (*ServerInterfaceWrapper) GetSimplePrimitive

func (siw *ServerInterfaceWrapper) GetSimplePrimitive(w http.ResponseWriter, r *http.Request)

GetSimplePrimitive operation middleware

type StdHTTPServerOptions

type StdHTTPServerOptions struct {
	BaseURL          string
	BaseRouter       ServeMux
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

StdHTTPServerOptions configures the StdHTTP server.

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

TooManyValuesForParamError is returned when a parameter has too many values.

func (*TooManyValuesForParamError) Error

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

UnescapedCookieParamError is returned when a cookie parameter cannot be unescaped.

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

UnmarshalingParamError is returned when a parameter cannot be unmarshaled.

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

Jump to

Keyboard shortcuts

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