Documentation
¶
Index ¶
- type Default
- func (d *Default) AddPathComments(ctx context.Context, sp *spec.Spec, opts *DefaultOptions) error
- func (d *Default) AddTags(ctx context.Context, sp *spec.Spec, opts *DefaultOptions) error
- func (d *Default) DefaultOptions() interface{}
- func (d *Default) Description() string
- func (d *Default) DescriptionMarkdown() string
- func (d *Default) ExtractAllOfs(ctx context.Context, sp *spec.Spec, opts *DefaultOptions) error
- func (d *Default) ExtractSchemas(ctx context.Context, sp *spec.Spec, opts *DefaultOptions) error
- func (d *Default) GenerateOperationNames(ctx context.Context, sp *spec.Spec, opts *DefaultOptions) error
- func (d *Default) GeneratePathNames(ctx context.Context, sp *spec.Spec, opts *DefaultOptions) error
- func (d *Default) GenerateResponseNames(ctx context.Context, sp *spec.Spec, opts *DefaultOptions) error
- func (d *Default) Name() string
- func (d *Default) OrderResources(ctx context.Context, sp *spec.Spec, opts *DefaultOptions) error
- func (d *Default) SimplifyInlineSchemas(ctx context.Context, sp *spec.Spec, opts *DefaultOptions) error
- func (d *Default) Transform(ctx context.Context, rawOpts interface{}, sp *spec.Spec) error
- type DefaultOptions
- type TagTemplateValues
- type Transformer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Default ¶
type Default struct{}
Default is the default Transformer.
func (*Default) AddPathComments ¶
AddPathComments adds additional comments such as parameters or responses to paths and their operations.
func (*Default) AddTags ¶
AddTags adds tags that were given in the options or automatic tags if they are enabled.
func (*Default) DefaultOptions ¶
func (d *Default) DefaultOptions() interface{}
DefaultOptions implements Transformer
func (*Default) Description ¶
Description implements Transformer
func (*Default) DescriptionMarkdown ¶
DescriptionMarkdown implements DescriptionMarkdown
func (*Default) ExtractAllOfs ¶
ExtractAllOfs creates all the types for AllOfs. AllOfs are a special type, all of their content are basically embedded structs.
func (*Default) ExtractSchemas ¶
ExtractSchemas extracts the nested schemas that need to be created. This only extracts schemas with a custom type, and leaves allOfs and such alone.
func (*Default) GenerateOperationNames ¶
func (d *Default) GenerateOperationNames(ctx context.Context, sp *spec.Spec, opts *DefaultOptions) error
GenerateOperationNames generates operation names if they don't already have one.
func (*Default) GeneratePathNames ¶
GeneratePathNames generates path names if they don't already have one.
func (*Default) GenerateResponseNames ¶
func (d *Default) GenerateResponseNames(ctx context.Context, sp *spec.Spec, opts *DefaultOptions) error
GenerateResponseNames generates response names if they don't already have one.
func (*Default) OrderResources ¶
OrderResources orders all the spec resources in an alphabetical order.
func (*Default) SimplifyInlineSchemas ¶
func (d *Default) SimplifyInlineSchemas(ctx context.Context, sp *spec.Spec, opts *DefaultOptions) error
SimplifyInlineSchemas simplifies inline schemas so that there will not be any attempts to create methods for them, and so on.
type DefaultOptions ¶
type DefaultOptions struct {
Tags map[string][]string `yaml:"tags,omitempty" description:"Add additional tags to struct fields. Supports Go templating with sprig functions"`
}
DefaultOptions alters the behaviour of the code generator.
func (*DefaultOptions) MarshalYAML ¶
func (d *DefaultOptions) MarshalYAML() (interface{}, error)
MarshalYAML implements YAML Marshaler.
type TagTemplateValues ¶
type TagTemplateValues struct { Description string `description:"Description of the schema"` FieldName string `description:"Name of the field"` Type string `description:"Type of the field"` }
TagTemplateValues contains values for tag templates.
type Transformer ¶
type Transformer interface { common.DescriptionMarkdown // The name of the transformer. Name() string // A short description of the transformer. Description() string // DefaultOptions Returns the default options of the transformer, or nil if it has none. DefaultOptions() interface{} // Transform transforms the specification based on options. Transform(ctx context.Context, options interface{}, specification *spec.Spec) error }
Transformer transforms a specification before code generation.