openapi

package
v2.0.0-...-7b30ef5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

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) EndArray

func (b *Buffer) EndArray()

func (*Buffer) EndObject

func (b *Buffer) EndObject()

func (*Buffer) Field

func (b *Buffer) Field(name string, value interface{})

func (*Buffer) Item

func (b *Buffer) Item(value interface{})

func (*Buffer) StartArray

func (b *Buffer) StartArray(names ...string)

func (*Buffer) StartObject

func (b *Buffer) StartObject(names ...string)

func (*Buffer) Write

func (b *Buffer) Write() error

Write creates the output file and writes the generated content.

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

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

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

Model sets the model that will be used by the types generator.

func (*OpenAPIGeneratorBuilder) Names

Names sets calculator that will be used to calculate names of OpenAPI things.

func (*OpenAPIGeneratorBuilder) Output

Output sets the output directory.

func (*OpenAPIGeneratorBuilder) Reporter

Reporter sets the object that will be used to report information about the generation process, including errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL