parserx

package
v0.0.0-...-6d7266f Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseApiSpec

func ParseApiSpec(filename string) (out *spec.ApiSpec, err error)

func ParseSwagJson

func ParseSwagJson(filename string) (out *spec.Swagger, err error)

Types

type ApiDeclare

type ApiDeclare struct {
	Tag          string `json:"tag"`
	FunctionName string `json:"function_name"`
	Summary      string `json:"summary"`

	//Base     string
	Router   string      `json:"router"`
	Method   string      `json:"method,omitempty"`
	Header   []*ApiParam `json:"header,omitempty"` // 请求头参数
	Path     []*ApiParam `json:"path,omitempty"`   // 路径参数 path
	Query    []*ApiParam `json:"query,omitempty"`  // 查询参数 query
	Form     []*ApiParam `json:"form,omitempty"`   // 表单参数 form-data
	Body     *ApiParam   `json:"body,omitempty"`   // 请求体参数
	Response *ApiParam   `json:"response"`         // 响应参数
}

api方法定义信息

type ApiParam

type ApiParam struct {
	Name        string `json:"name"`                  // 参数名 name
	Type        string `json:"type"`                  // 类型 object array string integer number boolean
	Description string `json:"description,omitempty"` // 描述
}

参数定义

type ApiParser

type ApiParser interface {
	ParseApi(filename string) (out *aspec.ApiSpec, err error)
}

func NewSpecParser

func NewSpecParser() ApiParser

func NewSwaggerParser

func NewSwaggerParser(opts ...SwaggerOption) ApiParser

type ModelDeclare

type ModelDeclare struct {
	//Pkg    string
	Type   string
	Extend []*ModelField
	Fields []*ModelField
}

model定义信息

type ModelField

type ModelField struct {
	Name    string // 属性名称  Name
	JsonTag string // json tag
	Type    string // 属性类型  string、int、bool、float、{UpperStartCamelName}
	Comment string // 属性的注释  属性名称
}

属性定义信息 Name string // 属性名称

type SpecParser

type SpecParser struct {
}

func (*SpecParser) ParseApi

func (s *SpecParser) ParseApi(filename string) (out *aspec.ApiSpec, err error)

type SwaggerOption

type SwaggerOption func(*SwaggerParser)

type SwaggerParser

type SwaggerParser struct {
	Base string
}

func (*SwaggerParser) ParseApi

func (s *SwaggerParser) ParseApi(filename string) (out *aspec.ApiSpec, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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