Documentation ¶
Index ¶
- Constants
- Variables
- func GetTypeName(typ reflect.Type) string
- func LoadParamStruct(obj interface{}, input LoadParamInput) (reflect.Value, error)
- func LoadPathParam(paths map[string]string, p *openapi3.Parameter, typ reflect.Type, ...) (reflect.Value, error)
- func LoadQueryParam(r *http.Request, typ reflect.Type, param *openapi3.Parameter, ...) (result reflect.Value, err error)
- func ParamsFromObj(obj interface{}, schemas Schemas, typs RegisteredTypes) (openapi3.Parameters, error)
- func ParamsFromType(typ reflect.Type, schemas Schemas, typs RegisteredTypes) (openapi3.Parameters, error)
- func SchemaFromObj(obj interface{}, schemas Schemas, typs RegisteredTypes) *openapi3.SchemaRef
- func VarToInterface(obj interface{}) (interface{}, error)
- type Components
- type Info
- type LoadParamInput
- type OpenAPI
- type OpenAPIDescriptor
- type Parameter
- type Parameters
- type RegisteredTypes
- type SchemaID
- type SchemaInline
- type Schemas
- type TypeOption
Constants ¶
View Source
const ComponentSchemasPath = "#/components/schemas/"
Variables ¶
View Source
var ErrNotStruct = fmt.Errorf("expected a struct")
Functions ¶
func GetTypeName ¶
func LoadParamStruct ¶
func LoadParamStruct(obj interface{}, input LoadParamInput) (reflect.Value, error)
LoadParamStruct takes a request, the param struct to populate, and the query params. The obj will have the fields populated based on the openapi schema
func LoadPathParam ¶
func LoadQueryParam ¶
func ParamsFromObj ¶
func ParamsFromObj(obj interface{}, schemas Schemas, typs RegisteredTypes) (openapi3.Parameters, error)
func ParamsFromType ¶
func ParamsFromType(typ reflect.Type, schemas Schemas, typs RegisteredTypes) (openapi3.Parameters, error)
func SchemaFromObj ¶
func SchemaFromObj(obj interface{}, schemas Schemas, typs RegisteredTypes) *openapi3.SchemaRef
SchemaFromObj returns an openapi3 schema for the object. For paramters, use ParamsFromObj.
func VarToInterface ¶
func VarToInterface(obj interface{}) (interface{}, error)
Types ¶
type Components ¶
type Components struct { Parameters map[reflect.Type]openapi3.Parameters Schemas Schemas RegisteredTypes RegisteredTypes }
Components is used to store shared data between various parts of the openapi doc
func NewComponents ¶
func NewComponents() Components
type LoadParamInput ¶
type LoadParamInput struct { *openapi3filter.RequestValidationInput Params []*openapi3.ParameterRef }
type OpenAPI ¶
type OpenAPI struct { *openapi3.T RegisteredTypes RegisteredTypes }
type OpenAPIDescriptor ¶
type OpenAPIDescriptor interface {
OpenAPIDescription() string
}
type Parameter ¶
func GetParameterType ¶
getParameterType will set the correct "in" value from the tag
type Parameters ¶
type Parameters map[string]*openapi3.ParameterRef
type RegisteredTypes ¶
type RegisteredTypes map[reflect.Type]TypeOption
type SchemaID ¶
type SchemaID interface {
SchemaID() string
}
SchemaID is used to override the name of the schema type
type SchemaInline ¶
type SchemaInline interface {
SchemaInline() bool
}
SchemaInline is used to determine whether or not to pull this schema out to the schemas collection
Source Files ¶
Click to show internal directories.
Click to hide internal directories.