importer

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeOpenAPI = "openapi"
	ModeSwagger = "swagger"
	ModeXSD     = "xsd"
	ModeGrammar = "grammar"
	ModeAuto    = "auto"
)
View Source
const (
	StringTypeName = "string"
	ObjectTypeName = "object"
	ArrayTypeName  = "array"
)
View Source
const (
	MinOnly maxType = iota
	MaxSpecified
	OpenEnded
)
View Source
const BlankLine = "&& !!"
View Source
const CommentLineLength = 80
View Source
const PopIndent = "&& <<"
View Source
const PushIndent = "&& >>"

Variables

View Source
var StringAlias = &SyslBuiltIn{name: StringTypeName}

Functions

func IsBuiltIn

func IsBuiltIn(name string) bool

func LoadGrammar

func LoadGrammar(args OutputData, grammarInput string, logger *logrus.Logger) (out string, err error)

func LoadOpenAPIText

func LoadOpenAPIText(args OutputData, text string, logger *logrus.Logger) (out string, err error)

func LoadSwaggerText

func LoadSwaggerText(args OutputData, text string, logger *logrus.Logger) (out string, err error)

func LoadXSDText

func LoadXSDText(args OutputData, text string, logger *logrus.Logger) (out string, err error)

Types

type Alias

type Alias struct {
	Target Type
	// contains filtered or unexported fields
}

!alias type without the EXTERNAL_ prefix

func (*Alias) Name

func (s *Alias) Name() string

type Array

type Array struct {
	Items Type
	// contains filtered or unexported fields
}

func (*Array) Name

func (s *Array) Name() string

type Endpoint

type Endpoint struct {
	Path        string
	Description string

	Params Parameters

	Responses []Response
}

type Enum

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

func (*Enum) Name

func (s *Enum) Name() string

type ExternalAlias

type ExternalAlias struct {
	Target Type
	// contains filtered or unexported fields
}

func (*ExternalAlias) Name

func (s *ExternalAlias) Name() string

type Field

type Field struct {
	Name       string
	Type       Type
	Optional   bool
	Attributes []string
	SizeSpec   *sizeSpec
}

type FieldList

type FieldList []Field

type Func

type Func func(args OutputData, text string, logger *logrus.Logger) (out string, err error)

type Grammar

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

type ImportedBuiltInAlias

type ImportedBuiltInAlias struct {
	Target Type
	// contains filtered or unexported fields
}

func (*ImportedBuiltInAlias) Name

func (s *ImportedBuiltInAlias) Name() string

type IndentWriter

type IndentWriter struct {
	io.Writer
	// contains filtered or unexported fields
}

func NewIndentWriter

func NewIndentWriter(text string, out io.Writer) *IndentWriter

func (*IndentWriter) CurrentIndentLen

func (i *IndentWriter) CurrentIndentLen() int

func (*IndentWriter) Pop

func (i *IndentWriter) Pop()

func (*IndentWriter) Push

func (i *IndentWriter) Push()

func (*IndentWriter) Write

func (i *IndentWriter) Write() error

type MethodEndpoints

type MethodEndpoints struct {
	Method    string // one of GET, POST, PUT, OPTION, etc
	Endpoints []Endpoint
}

type OutputData

type OutputData struct {
	AppName     string
	Package     string
	SwaggerRoot string
	Mode        string
}

type Param

type Param struct {
	Field
	In string
}

type Parameters

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

func (*Parameters) Add

func (p *Parameters) Add(param Param)

func (Parameters) BodyParams

func (p Parameters) BodyParams() []Param

func (*Parameters) Extend

func (p *Parameters) Extend(others Parameters) Parameters

func (Parameters) HeaderParams

func (p Parameters) HeaderParams() []Param

func (Parameters) PathParams

func (p Parameters) PathParams() []Param

func (Parameters) QueryParams

func (p Parameters) QueryParams() []Param

type Response

type Response struct {
	Text string
	Type Type
}

Response is either going to be freetext or a type

type StandardType

type StandardType struct {
	Properties FieldList
	Attributes []string
	// contains filtered or unexported fields
}

func (*StandardType) Name

func (s *StandardType) Name() string

type SyslBuiltIn

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

func (*SyslBuiltIn) Name

func (s *SyslBuiltIn) Name() string

type SyslInfo

type SyslInfo struct {
	OutputData

	Title       string
	Description string
	OtherFields []string // Ordered key, val pair
}

type Type

type Type interface {
	Name() string
}

func NewStringAlias

func NewStringAlias(name string) Type

type TypeList

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

func (*TypeList) Add

func (t *TypeList) Add(item ...Type)

func (*TypeList) AddAndRet

func (t *TypeList) AddAndRet(item Type) Type

func (TypeList) Find

func (t TypeList) Find(name string) (Type, bool)

func (TypeList) Items

func (t TypeList) Items() []Type

func (TypeList) Sort

func (t TypeList) Sort()

type Union

type Union struct {
	Options FieldList
	// contains filtered or unexported fields
}

func (*Union) Name

func (u *Union) Name() string

Directories

Path Synopsis
Package openapi2conv converts an OpenAPI v2 specification to v3.
Package openapi2conv converts an OpenAPI v2 specification to v3.

Jump to

Keyboard shortcuts

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