openapi

package
v0.0.0-...-9345cf7 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

README

OpenAPI

Documentation

Index

Constants

View Source
const DefinitionsRoot = "#/definitions/"

Variables

View Source
var (
	DefaultDefinitions = map[string]spec.Schema{}
	DefaultBuilder     = NewBuilder(InterfaceBuildOptionOverride, DefaultDefinitions)
)

Functions

func IntFmtProperty

func IntFmtProperty(format string) *spec.Schema

StrFmtProperty creates a property for the named string format

func IsDynamicInterface

func IsDynamicInterface(t reflect.Type) bool

func ObjectProperty

func ObjectProperty() *spec.Schema

func ObjectPropertyProperties

func ObjectPropertyProperties(properties spec.SchemaProperties) *spec.Schema

func TypeName

func TypeName(t reflect.Type) string

Types

type Builder

type Builder struct {
	InterfaceBuildOption InterfaceBuildOption
	Definitions          map[string]spec.Schema
}

func NewBuilder

func NewBuilder(interfaceOption InterfaceBuildOption, definations map[string]spec.Schema) *Builder

func (*Builder) Build

func (b *Builder) Build(data any) *spec.Schema

func (*Builder) BuildSchema

func (b *Builder) BuildSchema(v reflect.Value) *spec.Schema

type InterfaceBuildOption

type InterfaceBuildOption string
const (
	InterfaceBuildOptionDefault  InterfaceBuildOption = ""         // default as an 'object{}'
	InterfaceBuildOptionOverride InterfaceBuildOption = "override" // override using interface's value if exist
	InterfaceBuildOptionIgnore   InterfaceBuildOption = "ignore"   // ignore interface field
	InterfaceBuildOptionMerge    InterfaceBuildOption = "merge"    // anyOf 'object{}' type and interface's value type
)

type SchemaBuildFunc

type SchemaBuildFunc func(v reflect.Value) *spec.Schema

Jump to

Keyboard shortcuts

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