genspec

package
v0.0.0-...-b1d7106 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultIdentScheme = map[string]*openapi3.Schema{
	"int":    {Type: "integer"},
	"int32":  {Type: "integer", Format: "int32"},
	"int64":  {Type: "integer", Format: "int64"},
	"string": {Type: "string"},
}
View Source
var PathPattern = regexp.MustCompile("\\(([A-Z]+) (/.+)\\)")

Functions

func CSVMergeLines

func CSVMergeLines(src []string) []string

func CSVSplit

func CSVSplit(line string) ([]string, error)

func Convert

func Convert(src, dst interface{}) error

func ExpandTagForScheme

func ExpandTagForScheme(scheme *openapi3.Schema, tag KeyValue)

func GenerateOAuth2Scheme

func GenerateOAuth2Scheme(m map[interface{}]interface{}) (string, *openapi3.SecurityScheme, error)

func GenerateSecurityScheme

func GenerateSecurityScheme(text string) (string, *openapi3.SecurityScheme, error)

func GenerateSecuritySchemeInterface

func GenerateSecuritySchemeInterface(i interface{}) (string, *openapi3.SecurityScheme, error)

func GenerateSecuritySchemes

func GenerateSecuritySchemes(text string) (*openapi3.SecuritySchemes, error)

func MergeMapSlice

func MergeMapSlice(a *yaml.MapSlice, b *yaml.MapSlice)

func ParseMapSlice

func ParseMapSlice(str string) (*yaml.MapSlice, error)

func StringifyMapSlice

func StringifyMapSlice(obj *yaml.MapSlice) (string, error)

func TrimSpaceAll

func TrimSpaceAll(cells []string)

Types

type Config

type Config struct {
	Debug       bool
	PackageName string // `validate:"required"`
	InputFile   string `validate:"required"`
	OutputFile  string
}

type Generator

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

func NewGenerator

func NewGenerator(config *Config) (*Generator, error)

func (*Generator) Run

func (g *Generator) Run() error

type KeyValue

type KeyValue map[string]interface{}

func ParseTag

func ParseTag(tag string) KeyValue

func (KeyValue) ConvertFrom

func (kv KeyValue) ConvertFrom(m *map[interface{}]interface{})

func (KeyValue) UnmarshalYAML

func (kv KeyValue) UnmarshalYAML(unmarshal func(interface{}) error) error

type OpeDoc

type OpeDoc struct {
	Desc   string
	Method string
	Path   string
	KV     KeyValue
}

func ParseOpeDoc

func ParseOpeDoc(doc string) *OpeDoc

Jump to

Keyboard shortcuts

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