common

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	RouterNames []string       `yaml:"routerNames"`
	Request     []RequestRule  `yaml:"request"`
	Response    []ResponseRule `yaml:"response"`
}

type CustomRuleAnalyzer

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

func NewCustomRuleAnalyzer

func NewCustomRuleAnalyzer(ctx *analyzer.Context, spec *analyzer.APISpec, api *analyzer.API, c *Config) *CustomRuleAnalyzer

func (*CustomRuleAnalyzer) MatchCustomRequestRule

func (p *CustomRuleAnalyzer) MatchCustomRequestRule(node ast.Node) (matched bool)

func (*CustomRuleAnalyzer) MatchCustomResponseRule

func (p *CustomRuleAnalyzer) MatchCustomResponseRule(node ast.Node) (matched bool)

type DataProperties

type DataProperties map[string]*DataSchema

type DataSchema

type DataSchema struct {
	Type   DataType `json:"type"`
	Format string   `json:"format"`

	Properties DataProperties `json:"properties"`
	// set when Type='array'
	Item     *DataSchema `json:"item"`
	Optional bool        `json:"optional"`
}

type DataSchemaTransformer

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

func NewDataSchemaTransformer

func NewDataSchemaTransformer(dataSchema *DataSchema) *DataSchemaTransformer

func (*DataSchemaTransformer) TransformToGeneric

func (d *DataSchemaTransformer) TransformToGeneric() *spec.SchemaRef

func (*DataSchemaTransformer) TransformToSpecific

func (d *DataSchemaTransformer) TransformToSpecific(genericType *spec.SchemaRef, dataTypeFallback func(dataType *DataSchema) *spec.SchemaRef) *spec.SchemaRef

type DataType

type DataType string
const (
	DataTypeString  DataType = "string"
	DataTypeNumber  DataType = "number"
	DataTypeInteger DataType = "integer"
	DataTypeBoolean DataType = "boolean"
	DataTypeArray   DataType = "array"
	DataTypeFile    DataType = "file"
	DataTypeObject  DataType = "object"
)

type RequestReturn

type RequestReturn struct {
	Data        *DataSchema `yaml:"data"`
	ContentType string      `yaml:"contentType"`
}

type RequestRule

type RequestRule struct {
	Type   string         `yaml:"type"` // type name
	Method string         `yaml:"method"`
	Return *RequestReturn `yaml:"return"`
}

type ResponseReturn

type ResponseReturn struct {
	Status      string      `yaml:"status"`
	Data        *DataSchema `yaml:"data"`
	ContentType string      `yaml:"contentType"`
}

type ResponseRule

type ResponseRule struct {
	Node   string          `yaml:"node"`
	Type   string          `yaml:"type"` // type name
	Method string          `yaml:"method"`
	Return *ResponseReturn `yaml:"return"`
}

Jump to

Keyboard shortcuts

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