parser

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectRequestBodyType

func DetectRequestBodyType(fn *ast.FuncDecl) (map[string]string, error)

func DetectResponseModel

func DetectResponseModel(fn *ast.FuncDecl) map[string]string

Types

type GlobalMetadata

type GlobalMetadata struct {
	GlobalTitle       string
	GlobalVersion     string
	GlobalDescription string
}

func ParseGlobalMetadata

func ParseGlobalMetadata(filePath string) GlobalMetadata
type Header struct {
	StatusCode  string
	Name        string
	Type        string
	Required    bool
	Description string
}

func DetectHeaders

func DetectHeaders(fn *ast.FuncDecl) ([]Header, error)

type Parameter

type Parameter struct {
	Name        string
	In          string // path, query, header, cookie
	Required    bool
	Schema      string // string, integer, etc.
	Description string
}

func DetectParametersAndQuery

func DetectParametersAndQuery(fn *ast.FuncDecl) ([]Parameter, error)

type RequestBody

type RequestBody struct {
	Model       string
	Required    bool
	MediaType   string // Default: application/json
	Description string
}

type Response

type Response struct {
	Model       string
	MediaType   string
	StatusCode  string
	Description string
}

type RouteDoc

type RouteDoc struct {
	Summary         string
	Description     string
	Method          string
	Path            string
	Tags            []string
	Params          []Parameter
	RequestBody     *RequestBody
	Responses       map[string]Response
	Headers         []Header
	SecuritySchemes []SecurityScheme
	Deprecated      bool
}

func ParseDirectory

func ParseDirectory(dir string) ([]RouteDoc, error)

ParseDirectory parses all .go files in a folder and extracts annotations

type SecurityScheme added in v1.3.0

type SecurityScheme struct {
	Name       string // e.g., "ApiKeyAuth", "BearerAuth"
	HeaderName string // For ApiKeyAuth: custom header name (optional)
}

Jump to

Keyboard shortcuts

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