Documentation ¶
Overview ¶
Package example modified from https://github.com/danielgtaylor/apisprout
Index ¶
- Variables
- func GetBodyExample(mode Mode, mt *openapi3.MediaType) (interface{}, error)
- func GetParameterExample(mode Mode, p *openapi3.Parameter) (interface{}, error)
- func GetResponseExample(mode Mode, p *openapi3.MediaType) (interface{}, error)
- func OpenAPIExample(mode Mode, schema *openapi3.Schema) (interface{}, error)
- type Mode
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoExample is sent when no example was found for an operation. ErrNoExample = errors.New("no example found") // ErrRecursive is when a schema is impossible to represent because it infinitely recurses. ErrRecursive = errors.New("recursive schema") // ErrCannotMarshal is set when an example cannot be marshalled. ErrCannotMarshal = errors.New("cannot marshal example") // ErrMissingAuth is set when no authorization header or key is present but // one is required by the API description. ErrMissingAuth = errors.New("missing auth") // ErrInvalidAuth is set when the authorization scheme doesn't correspond // to the one required by the API description. ErrInvalidAuth = errors.New("invalid auth") )
Functions ¶
func GetBodyExample ¶
GetBodyExample ###
func GetParameterExample ¶
GetParameterExample ###
func GetResponseExample ¶
GetResponseExample ###
func OpenAPIExample ¶
OpenAPIExample creates an example structure from an OpenAPI 3 schema object, which is an extended subset of JSON Schema. https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#schemaObject
Types ¶
Click to show internal directories.
Click to hide internal directories.