openapi

package
v0.39.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 28 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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)

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) Example added in v0.10.0

func (c *ComponentSchema) Example(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, ioConfig *config.IOConfig) *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(fieldName string, rType reflect.Type, description string, ioConfig *config.IOConfig, 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, ioConfig *config.IOConfig, isInput bool) (*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
	JSONName     string

	TypeName  string
	Parameter *tags.Parameter
	IsInput   bool
	Column    string
	Table     string
	// contains filtered or unexported fields
}

func ParseTag

func ParseTag(field reflect.StructField, tag reflect.StructTag, isInput bool, rootTable string) (*Tag, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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