Documentation ¶
Overview ¶
Package parser parses API definitions in Go
Package parser parses API definitions in Go ¶
Package parser parses API definitions in Go
Index ¶
Constants ¶
const ( // QueryParamTag is the tag name for parameters in query QueryParamTag = "param" // JSONParamTag is the tag name for JSON JSONParamTag = "json" )
const FormTagKey = "form"
FormTagKey is a tag key for fields uploaded in multipart
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Endpoint ¶
type Endpoint struct { Method MethodType RawPath, Path string Placeholder string UseMultipartUpload bool RequestPayloadName string ResponsePayloadName string RequestPayload *ast.StructType ResponsePayload *ast.StructType RequestGo2tsPayload *eptypes.Object ResponseGo2tsPayload *eptypes.Object SwagComments []string File string RequestPos, ResponsePos token.Pos RequestLine, ResponseLine int // contains filtered or unexported fields }
Endpoint represents one HTTP endpoint
type FileField ¶ added in v2.6.0
type FileField struct { Key string Value eptypes.ObjectEntry FormTag string Type MultipartUploadType }
FileField is a result type for GetFileFields
type Group ¶
type Group struct { ImportPath string RawPath, Path string Dir string Placeholder string ParsedTypes map[string]eptypes.Type Children []*Group Endpoints []*Endpoint // contains filtered or unexported fields }
Group is a layer for endpoints
type MethodType ¶
type MethodType string
MethodType represents methods for HTTP
const ( // GET is GET method for HTTP GET MethodType = "GET" // POST is POST method for HTTP POST MethodType = "POST" // PUT is PUT method for HTTP PUT MethodType = "PUT" // DELETE is method for HTTP DELETE MethodType = "DELETE" // PATCH is method for HTTP PATCH MethodType = "PATCH" )
type MultipartHeader ¶ added in v2.6.0
MultipartHeader is mime/multipart.FileHeader
func (*MultipartHeader) String ¶ added in v2.6.0
func (uf *MultipartHeader) String() string
String returns this type in string representation
func (*MultipartHeader) UsedAsMapKey ¶ added in v2.6.0
func (uf *MultipartHeader) UsedAsMapKey() bool
UsedAsMapKey returns whether this type can be used as the key for map
type MultipartUploadType ¶ added in v2.6.0
type MultipartUploadType int
MultipartUploadType is a type
const ( // UploadNone means no the field is not a file UploadNone MultipartUploadType = iota // UploadSingleFile means the field is a file UploadSingleFile // UploadMultipleFiles means the field is a slice of files UploadMultipleFiles )
func GetMultipartUploadType ¶ added in v2.6.0
func GetMultipartUploadType(t eptypes.Type) MultipartUploadType
GetMultipartUploadType checks t is *multipart.FileHeader or []*multipart.FileHeader Multipart data in map are not supported
func ValidateMultipartUploadType ¶ added in v2.6.0
func ValidateMultipartUploadType(t eptypes.Type, tag string) (MultipartUploadType, error)
ValidateMultipartUploadType checks t is *multipart.FileHeader or []*multipart.FileHeader And validate form tag