openapi

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApplicationJson = "application/json"
)
View Source
const (
	SuccessSchemaDescription = "Success object schema"
)

Variables

This section is empty.

Functions

func GenerateOpenAPI3Spec

func GenerateOpenAPI3Spec(ctx context.Context, components *repository.Service, info openapi.Info, providers ...*repository.Provider) (*openapi.OpenAPI, error)

func IsHttpParamKind

func IsHttpParamKind(kind state.Kind) bool

Types

type ComponentSchema

type ComponentSchema struct {
	// contains filtered or unexported fields
}

func NewComponentSchema

func NewComponentSchema(components *repository.Service, component *repository.Component, container *SchemaContainer) *ComponentSchema

func (*ComponentSchema) Description

func (c *ComponentSchema) Description(ctx context.Context, path string, defaultDescription string) (string, error)

func (*ComponentSchema) GenerateSchema

func (c *ComponentSchema) GenerateSchema(ctx context.Context, schema *Schema) (*openapi3.Schema, error)

func (*ComponentSchema) GetOrGenerateSchema

func (c *ComponentSchema) GetOrGenerateSchema(ctx context.Context, schema *Schema) (*openapi3.Schema, error)

func (*ComponentSchema) ReflectSchema

func (c *ComponentSchema) ReflectSchema(name string, rType reflect.Type, description string, toFormatter text.CaseFormat) *Schema

func (*ComponentSchema) RequestBody

func (c *ComponentSchema) RequestBody(ctx context.Context) (*Schema, error)

func (*ComponentSchema) ResponseBody

func (c *ComponentSchema) ResponseBody(ctx context.Context) (*Schema, error)

func (*ComponentSchema) SchemaWithTag

func (c *ComponentSchema) SchemaWithTag(name string, rType reflect.Type, description string, toFormatter text.CaseFormat, tag Tag) *Schema

func (*ComponentSchema) TypeName

func (c *ComponentSchema) TypeName(schemaType reflect.Type, defaultValue string) string

func (*ComponentSchema) TypedSchema

func (c *ComponentSchema) TypedSchema(ctx context.Context, stateType state.Type, defaultTypeName string, toFormatter text.CaseFormat) (*Schema, error)

type PathsBuilder

type PathsBuilder struct {
	// contains filtered or unexported fields
}

func (*PathsBuilder) AddPath

func (b *PathsBuilder) AddPath(URI string, path *openapi.PathItem)

type Schema

type Schema struct {
	// contains filtered or unexported fields
}

func (*Schema) Field

func (s *Schema) Field(field reflect.StructField, tag Tag) (*Schema, error)

func (*Schema) SliceItem

func (s *Schema) SliceItem(rType reflect.Type) *Schema

type SchemaContainer

type SchemaContainer struct {
	// contains filtered or unexported fields
}

func NewContainer

func NewContainer() *SchemaContainer

func (*SchemaContainer) CreateSchema

func (c *SchemaContainer) CreateSchema(ctx context.Context, componentSchema *ComponentSchema, fieldSchema *Schema) (*openapi3.Schema, error)

func (*SchemaContainer) SchemaRef

func (c *SchemaContainer) SchemaRef(schemaName string, description string) *openapi3.Schema

type Tag

type Tag struct {
	Format      string
	Inlined     bool
	Ignore      bool
	Description string
	CaseFormat  string

	IsNullable   bool
	Min          *float64
	Max          *float64
	ExclusiveMax bool
	ExclusiveMin bool
	MaxLength    *uint64
	MinLength    uint64
	WriteOnly    bool
	ReadOnly     bool
	MaxItems     *uint64
	Default      interface{}
	Example      string

	TypeName string
	// contains filtered or unexported fields
}

func ParseTag

func ParseTag(field reflect.StructField, tag reflect.StructTag) (Tag, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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