Documentation ¶
Index ¶
- Variables
- type OpenAPI3
- func (o *OpenAPI3) DefaultOptions() interface{}
- func (o *OpenAPI3) Description() string
- func (o *OpenAPI3) DescriptionMarkdown() string
- func (o *OpenAPI3) ExtensionExamples() map[string]interface{}
- func (o *OpenAPI3) GetExtension(name string, extensions map[string]interface{}, dst interface{}) error
- func (o *OpenAPI3) Name() string
- func (o *OpenAPI3) Parse(ctx context.Context, rawOpts interface{}, data []byte) (*spec.Spec, error)
- func (o *OpenAPI3) ParseCallbacks(ctx context.Context, cbs map[string]*openapi3.CallbackRef, ...) (map[string][]*spec.Path, error)
- func (o *OpenAPI3) ParseOperation(ctx context.Context, op *openapi3.Operation, opts *OpenAPI3Options) (*spec.Operation, error)
- func (o *OpenAPI3) ParseParameter(ctx context.Context, p *openapi3.ParameterRef, opts *OpenAPI3Options) ([]*spec.Parameter, error)
- func (o *OpenAPI3) ParsePath(ctx context.Context, swPath *openapi3.PathItem, opts *OpenAPI3Options) (*spec.Path, error)
- func (o *OpenAPI3) ParsePaths(ctx context.Context, sp *spec.Spec, swagger *openapi3.Swagger, ...) error
- func (o *OpenAPI3) ParseResources(ctx context.Context, options interface{}, paths ...string) (*spec.Spec, error)
- func (o *OpenAPI3) ParseSchema(ctx context.Context, oapi3Schema *openapi3.SchemaRef, opts *OpenAPI3Options, ...) (*spec.Schema, error)
- func (o *OpenAPI3) ParseSchemas(ctx context.Context, sp *spec.Spec, swagger *openapi3.Swagger, ...) error
- func (o *OpenAPI3) StripExtension(ctx context.Context, swagger *openapi3.Swagger, opts *OpenAPI3Options) error
- type OpenAPI3Options
- type OpenAPI3PathExtension
- type OpenAPI3ResponseExtension
- type OpenAPI3SchemaExtension
- type Parser
Constants ¶
This section is empty.
Variables ¶
var ErrExtNotFound = errors.New("extension not found")
ErrExtNotFound is returned if an extension doesn't exist
Functions ¶
This section is empty.
Types ¶
type OpenAPI3 ¶
type OpenAPI3 struct{}
OpenAPI3 parses Open API 3.x.x specifications
func (*OpenAPI3) DefaultOptions ¶
func (o *OpenAPI3) DefaultOptions() interface{}
DefaultOptions implements Parser
func (*OpenAPI3) Description ¶
Description implements Parser
func (*OpenAPI3) DescriptionMarkdown ¶
DescriptionMarkdown implements DescriptionMarkdown
func (*OpenAPI3) ExtensionExamples ¶
ExtensionExamples implements Parser
func (*OpenAPI3) GetExtension ¶
func (o *OpenAPI3) GetExtension(name string, extensions map[string]interface{}, dst interface{}) error
GetExtension gets an extension from a schema
func (*OpenAPI3) ParseCallbacks ¶
func (o *OpenAPI3) ParseCallbacks(ctx context.Context, cbs map[string]*openapi3.CallbackRef, opts *OpenAPI3Options) (map[string][]*spec.Path, error)
ParseCallbacks parses the callbacks of an operation.
func (*OpenAPI3) ParseOperation ¶
func (o *OpenAPI3) ParseOperation(ctx context.Context, op *openapi3.Operation, opts *OpenAPI3Options) (*spec.Operation, error)
ParseOperation parses an Open API 3 operation
func (*OpenAPI3) ParseParameter ¶
func (o *OpenAPI3) ParseParameter(ctx context.Context, p *openapi3.ParameterRef, opts *OpenAPI3Options) ([]*spec.Parameter, error)
ParseParameter parses a parameter. It can return multiple parameters, if the parameter has multiple content types.
func (*OpenAPI3) ParsePath ¶
func (o *OpenAPI3) ParsePath(ctx context.Context, swPath *openapi3.PathItem, opts *OpenAPI3Options) (*spec.Path, error)
ParsePath parses a single path item.
func (*OpenAPI3) ParsePaths ¶
func (o *OpenAPI3) ParsePaths(ctx context.Context, sp *spec.Spec, swagger *openapi3.Swagger, opts *OpenAPI3Options) error
ParsePaths parses the paths of the specification
func (*OpenAPI3) ParseResources ¶
func (o *OpenAPI3) ParseResources(ctx context.Context, options interface{}, paths ...string) (*spec.Spec, error)
ParseResources implements Parser
func (*OpenAPI3) ParseSchema ¶
func (o *OpenAPI3) ParseSchema( ctx context.Context, oapi3Schema *openapi3.SchemaRef, opts *OpenAPI3Options, visited ...*spec.Schema, ) (*spec.Schema, error)
ParseSchema parses the Open API 3 schema and returns a Schema
func (*OpenAPI3) ParseSchemas ¶
func (o *OpenAPI3) ParseSchemas(ctx context.Context, sp *spec.Spec, swagger *openapi3.Swagger, opts *OpenAPI3Options) error
ParseSchemas parses the schema definitions
func (*OpenAPI3) StripExtension ¶
func (o *OpenAPI3) StripExtension(ctx context.Context, swagger *openapi3.Swagger, opts *OpenAPI3Options) error
StripExtension strips the extension from the swagger specification and serialize it to the options.
type OpenAPI3Options ¶
type OpenAPI3Options struct { ExtensionName string `yaml:"extensionName,omitempty" description:"The name of the extension field"` ResolveReferencesAt string `yaml:"resolveReferencesAt,omitempty" description:"Resolve references at the given URL"` ResolveReferencesIn string `yaml:"resolveReferencesIn,omitempty" description:"Resolve references in a local folder"` AdditionalPropertiesName string `yaml:"additionalPropertiesName" description:"Name of the additionalProperties field in structs that have them"` StripExtension bool `` /* 276-byte string literal not displayed */ }
OpenAPI3Options are options for the OpenAPI 3 parser.
func (*OpenAPI3Options) MarshalYAML ¶
func (o *OpenAPI3Options) MarshalYAML() (interface{}, error)
MarshalYAML implements YAML Marshaler
type OpenAPI3PathExtension ¶
type OpenAPI3PathExtension struct {
Name *string `yaml:"name,omitempty" json:"name,omitempty" description:"The name of the path"`
}
OpenAPI3PathExtension is for specifications that support extensions. With it, a specification can alter the properties of code generation of the path.
func (*OpenAPI3PathExtension) MarshalYAML ¶
func (o *OpenAPI3PathExtension) MarshalYAML() (interface{}, error)
MarshalYAML implements YAML Marshaler
type OpenAPI3ResponseExtension ¶
type OpenAPI3ResponseExtension struct {
Name *string `yaml:"name,omitempty" json:"name,omitempty" description:"The name of the response"`
}
OpenAPI3ResponseExtension is for specifications that support extensions. With it, a specification can alter the properties of code generation of the path.
func (*OpenAPI3ResponseExtension) MarshalYAML ¶
func (o *OpenAPI3ResponseExtension) MarshalYAML() (interface{}, error)
MarshalYAML implements YAML Marshaler
type OpenAPI3SchemaExtension ¶
type OpenAPI3SchemaExtension struct { Type *string `yaml:"type,omitempty" json:"type,omitempty" description:"The Go type of the schema"` Create *bool `yaml:"create,omitempty" json:"create,omitempty" description:"Whether the type should be created"` CanBeNil *bool `` /* 283-byte string literal not displayed */ Tags map[string][]string `yaml:"tags,omitempty" json:"tags,omitempty" description:"Additional tags for the field"` }
OpenAPI3SchemaExtension is for specifications that support extensions. A specification can alter the properties of code generation of the schema with it.
func (*OpenAPI3SchemaExtension) MarshalYAML ¶
func (o *OpenAPI3SchemaExtension) MarshalYAML() (interface{}, error)
MarshalYAML implements YAML Marshaler
type Parser ¶
type Parser interface { // The name of the parser. Name() string // A short description of the parser. Description() string // DefaultOptions Returns the default options of the parser, or nil if it has none. DefaultOptions() interface{} // Parse parses a specification from data. Parse(ctx context.Context, options interface{}, data []byte) (*spec.Spec, error) // ParseResources parses a specification from one or more resources. ParseResources(ctx context.Context, options interface{}, paths ...string) (*spec.Spec, error) }
Parser parses a specification, and returns the spec needed for code generation.