funcspec

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	Name     string
	Type     string
	JSONName string // json tag name (empty = use Name)
}

Field represents a struct field.

type FuncSpec

type FuncSpec struct {
	Package         string   // "auth"
	Name            string   // "hashPassword"
	Description     string   // @description value
	ErrStatus       int      // @error HTTP status code (0 = unspecified)
	RequestFields   []Field  // FuncNameRequest struct fields
	ResponseFields  []Field  // FuncNameResponse struct fields
	ResponsePointer bool     // true if function's first return is *T (used for @empty nilable detection)
	HasBody         bool     // true if function body is not just "// TODO: implement"
	Imports         []string // import paths (e.g. "database/sql", "net/http")
}

FuncSpec holds a parsed func spec file.

func ParseDir

func ParseDir(dir string) ([]FuncSpec, []diagnostic.Diagnostic)

ParseDir parses all .go files under dir (recursively by package subdirectory). Returns a flat list of FuncSpecs and accumulated diagnostics.

func ParseFile

func ParseFile(path string) (*FuncSpec, []diagnostic.Diagnostic)

ParseFile parses a single func spec .go file.

Jump to

Keyboard shortcuts

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