parser

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToSchema

func ConvertToSchema(source interface{}, rootKey string) map[string]*openapi3.SchemaRef

ConvertToSchema schematization method

Types

type Builder

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

Builder

func NewBuilder

func NewBuilder(path PathParser) *Builder

func (*Builder) BuildPathMethod

func (b *Builder) BuildPathMethod() *openapi3.Swagger

func (*Builder) RequiredField

func (b *Builder) RequiredField() func(input string) error

func (*Builder) SetSource

func (b *Builder) SetSource(source *wizard.Request)

func (*Builder) SetSwagger

func (b *Builder) SetSwagger(sw *openapi3.Swagger)

type Curl

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

Curl structure

func NewCurl

func NewCurl() *Curl

NewCurl processing constructor

func (*Curl) CreateTemplatePath

func (c *Curl) CreateTemplatePath(path *Path) string

CreateTemplatePath - trying to identify variables on the path

func (*Curl) FindType

func (c *Curl) FindType(s string) string

func (*Curl) Parse

func (c *Curl) Parse() (*Path, error)

Parse process the transferred data and return the path.

func (*Curl) RequiredField

func (c *Curl) RequiredField() func(input string) error

RequiredField validation field

func (*Curl) SetText

func (c *Curl) SetText(text string)

SetText

func (*Curl) SetUniqueName

func (c *Curl) SetUniqueName(path *Path)

SetUniqueName

func (*Curl) Split

func (c *Curl) Split() ([]string, error)

Split divide the transmitted messages into commands.

func (*Curl) Text added in v0.0.7

func (c *Curl) Text() string

func (*Curl) Unmarshal

func (c *Curl) Unmarshal(b string) (map[string]interface{}, error)

Unmarshal

type Fetch

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

func NewFetch

func NewFetch() *Fetch

func (*Fetch) Parse

func (f *Fetch) Parse() (*Path, error)

func (*Fetch) RequiredField

func (f *Fetch) RequiredField() func(input string) error

func (*Fetch) SetText

func (f *Fetch) SetText(text string)

type Parser

type Parser interface {
	SetSource(source *wizard.Request)
	SetSwagger(sw *openapi3.Swagger)
	RequiredField() func(input string) error
	BuildPathMethod() *openapi3.Swagger
}

Parser behavioral abstraction

func NewParser

func NewParser(t Type) (Parser, error)

NewParser factory abstraction

type Path

type Path struct {
	Method         string
	SourceURL      string
	URL            *url.URL
	TemplatePath   string
	Headers        map[string]string
	PathVariables  []*Variable
	QueryVariables []*Variable
	UniqueName     string
	SourceRequest  string
	ParseRequest   map[string]interface{}
}

Path structure that we return after processing

func (*Path) HasAuthorization added in v0.0.6

func (path *Path) HasAuthorization() bool

HasAuthorization has auth check

type PathParser

type PathParser interface {
	Parse() (*Path, error)
	SetText(text string)
	RequiredField() func(input string) error
}

PathParser behavioral abstraction

type Type

type Type string
var CurlType Type = "curl"
var FetchType Type = "fetch"

type Variable

type Variable struct {
	Example string
	// contains filtered or unexported fields
}

Variable structure for determining path or query variables

Jump to

Keyboard shortcuts

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