Documentation ¶
Index ¶
- type Buffer
- type BufferBuilder
- type NamesCalculator
- func (c *NamesCalculator) AttributePropertyName(attribute *concepts.Attribute) string
- func (c *NamesCalculator) FileName(version *concepts.Version) string
- func (c *NamesCalculator) ParameterPropertyName(parameter *concepts.Parameter) string
- func (c *NamesCalculator) SchemaName(typ *concepts.Type) string
- type NamesCalculatorBuilder
- type OpenAPIGenerator
- type OpenAPIGeneratorBuilder
- func (b *OpenAPIGeneratorBuilder) Binding(value *http.BindingCalculator) *OpenAPIGeneratorBuilder
- func (b *OpenAPIGeneratorBuilder) Build() (generator *OpenAPIGenerator, err error)
- func (b *OpenAPIGeneratorBuilder) Model(value *concepts.Model) *OpenAPIGeneratorBuilder
- func (b *OpenAPIGeneratorBuilder) Names(value *NamesCalculator) *OpenAPIGeneratorBuilder
- func (b *OpenAPIGeneratorBuilder) Output(value string) *OpenAPIGeneratorBuilder
- func (b *OpenAPIGeneratorBuilder) Reporter(value *reporter.Reporter) *OpenAPIGeneratorBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is a type that simplifies the generation of OpenAPI specifications.
func (*Buffer) StartArray ¶
func (*Buffer) StartObject ¶
type BufferBuilder ¶
type BufferBuilder struct {
// contains filtered or unexported fields
}
BufferBuilder is used to create a new OpenAPI buffer. Don't create it directly, use the NewBuffer function instead.
func NewBufferBuilder ¶
func NewBufferBuilder() *BufferBuilder
NewBuffer creates a builder for OpenAPI buffers.
func (*BufferBuilder) Build ¶
func (b *BufferBuilder) Build() (buffer *Buffer, err error)
Build creates a new buffer using the configuration stored in the builder.
func (*BufferBuilder) Output ¶
func (b *BufferBuilder) Output(value string) *BufferBuilder
Output sets the name of the file where the OpenAPI specifications will be generated.
func (*BufferBuilder) Reporter ¶
func (b *BufferBuilder) Reporter(reporter *reporter.Reporter) *BufferBuilder
Reporter sets the object that will be used to report errors and other relevant information.
type NamesCalculator ¶
type NamesCalculator struct {
// contains filtered or unexported fields
}
NamesCalculator is an object used to calculate OpenAPI names. Don't create instances directly, use the builder instead.
func (*NamesCalculator) AttributePropertyName ¶
func (c *NamesCalculator) AttributePropertyName(attribute *concepts.Attribute) string
AttributePropertyName calculates the property name for an attribute of a struct type.
func (*NamesCalculator) FileName ¶
func (c *NamesCalculator) FileName(version *concepts.Version) string
FileName calculates the relative file path where the specification for the given service version should be written. For example if the service identifier is `clusters_mgmt` and the version identifiers is `v1` then the result will be `clusters_mgmt/v1/openapi.json`.
func (*NamesCalculator) ParameterPropertyName ¶
func (c *NamesCalculator) ParameterPropertyName(parameter *concepts.Parameter) string
ParameterPropertyName calculates the property name for an parameter of a method.
func (*NamesCalculator) SchemaName ¶
func (c *NamesCalculator) SchemaName(typ *concepts.Type) string
SchemaName calculates the schema name for the given type.
type NamesCalculatorBuilder ¶
type NamesCalculatorBuilder struct {
// contains filtered or unexported fields
}
NamesCalculatorBuilder is an object used to configure and build the OpenAPI names calculators. Don't create instances directly, use the NewNamesCalculator function instead.
func NewNamesCalculator ¶
func NewNamesCalculator() *NamesCalculatorBuilder
NewNamesCalculator creates an OpenAPI names calculator builder.
func (*NamesCalculatorBuilder) Build ¶
func (b *NamesCalculatorBuilder) Build() (calculator *NamesCalculator, err error)
Build checks the configuration stored in the builder and, if it is correct, creates a new calculator using it.
func (*NamesCalculatorBuilder) Reporter ¶
func (b *NamesCalculatorBuilder) Reporter(value *reporter.Reporter) *NamesCalculatorBuilder
Reporter sets the object that will be used to report information about the calculation processes, including errors.
type OpenAPIGenerator ¶
type OpenAPIGenerator struct {
// contains filtered or unexported fields
}
OpenAPIGenerator generates OpenAPI specifications for the model.
func (*OpenAPIGenerator) Run ¶
func (g *OpenAPIGenerator) Run() error
Run executes the code generator.
type OpenAPIGeneratorBuilder ¶
type OpenAPIGeneratorBuilder struct {
// contains filtered or unexported fields
}
OpenAPIGeneratorBuilder is an object used to configure and build the OpenAPI specifications generator. Don't create instances directly, use the NewOpenAPIGenerator function instead.
func NewOpenAPIGenerator ¶
func NewOpenAPIGenerator() *OpenAPIGeneratorBuilder
NewOpenAPIGenerator creates a new builder for OpenAPI specification generators.
func (*OpenAPIGeneratorBuilder) Binding ¶
func (b *OpenAPIGeneratorBuilder) Binding(value *http.BindingCalculator) *OpenAPIGeneratorBuilder
Binding sets the object that will by used to do HTTP binding calculations.
func (*OpenAPIGeneratorBuilder) Build ¶
func (b *OpenAPIGeneratorBuilder) Build() (generator *OpenAPIGenerator, err error)
Build checks the configuration stored in the builder and, if it is correct, creates a new OpenAPI specifications generator using it.
func (*OpenAPIGeneratorBuilder) Model ¶
func (b *OpenAPIGeneratorBuilder) Model(value *concepts.Model) *OpenAPIGeneratorBuilder
Model sets the model that will be used by the types generator.
func (*OpenAPIGeneratorBuilder) Names ¶
func (b *OpenAPIGeneratorBuilder) Names(value *NamesCalculator) *OpenAPIGeneratorBuilder
Names sets calculator that will be used to calculate names of OpenAPI things.
func (*OpenAPIGeneratorBuilder) Output ¶
func (b *OpenAPIGeneratorBuilder) Output(value string) *OpenAPIGeneratorBuilder
Output sets the output directory.
func (*OpenAPIGeneratorBuilder) Reporter ¶
func (b *OpenAPIGeneratorBuilder) Reporter(value *reporter.Reporter) *OpenAPIGeneratorBuilder
Reporter sets the object that will be used to report information about the generation process, including errors.