spec

package
v0.4.25 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

README

Spec Package — OpenAPI Specification Generation

This package generates OpenAPI 3.1 specifications from Go code metadata. It is framework-agnostic and pattern-driven.

Architecture

config.go          Pattern types + framework defaults
  ↓
extractor.go       Unified visitor + pattern matching → RouteInfo
  ↓
mapper.go          RouteInfo → OpenAPI schemas + paths
  ↓
openapi.go         OpenAPI 3.1 type definitions
Key Files
File Purpose
config.go BasePattern, 6 pattern types, APISpecConfig, 6 framework defaults
extractor.go Extractor, visitChildren visitor, response/request/param/content-type extraction, interface resolution, conditional method detection
pattern_matchers.go baseMatchNode, basePriority, Route/Mount/Request matchers
mapper.go MapMetadataToOpenAPI, schema generation, generic struct instantiation, shortening, disambiguation
type_utils.go sharedResolveTypeOrigin — single type resolution function for all matchers
tracker.go TrackerTree — transforms flat call graph into traversable tree
openapi.go OpenAPI 3.1 struct types (OpenAPISpec, PathItem, Operation, Schema, etc.)
schema_mapper.go Low-level Go type → OpenAPI type mapping
visualization.go Cytoscape.js call graph diagram generation
export.go HTML/JSON export for diagrams
Pattern System

All pattern types embed BasePattern with shared matching fields:

type BasePattern struct {
    CallRegex, FunctionNameRegex, RecvType, RecvTypeRegex string
    CallerPkgPatterns, CallerRecvTypePatterns             []string
    CalleePkgPatterns, CalleeRecvTypePatterns             []string
}

6 pattern types: RoutePattern, RequestBodyPattern, ResponsePattern, ParamPattern, MountPattern, ContentTypePattern.

All 5 matcher implementations delegate to baseMatchNode() and basePriority() — zero duplicated matching logic.

Extraction Pipeline

The Extractor uses a unified visitor (visitChildren) with registered callbacks:

callbacks := []ExtractionCallback{
    routeDetection,
    requestExtraction,
    responseExtraction,
    paramExtraction,
    contentTypeDetection,
    mapIndexParamExtraction,
}
e.visitChildren(node, route, callbacks)

Adding a new extraction type requires only registering a callback — no traversal code.

CFG Integration

Call graph edges and assignments carry BranchContext from golang.org/x/tools/go/cfg:

type BranchContext struct {
    BlockIndex    int32
    BlockKind     string   // "if-then", "if-else", "switch-case"
    CaseValues    []string // e.g., ["GET", "POST"] for switch cases
}

This enables conditional HTTP method detection (switch r.Method) and branch-aware analysis.

Type Resolution

sharedResolveTypeOrigin() in type_utils.go is the single function for resolving argument types across all matchers. It checks:

  1. arg.GetResolvedType() — direct resolution
  2. Generic type parameter maps
  3. Assignment maps for variable tracing
  4. Constant return values for cross-function resolution
Interface Resolution

When a route handler is an interface method:

  1. isInterfaceHandler() checks metadata for interface types
  2. resolveInterfaceHandler() searches the call graph for concrete implementations
  3. Response patterns are matched against concrete method's edges
Templates

HTML templates for call graph visualization (in templates/ subdirectory):

  • templates/cytoscape_template.html — main interactive diagram
  • templates/paginated_template.html — paginated version for large graphs
  • templates/server_template.htmlapidiag server template

Documentation

Index

Constants

View Source
const (
	TypeSep = "-->"
)

Variables

View Source
var HTTPStatusByName = map[string]int{

	"StatusContinue":           100,
	"StatusSwitchingProtocols": 101,
	"StatusProcessing":         102,
	"StatusEarlyHints":         103,

	"StatusOK":                   200,
	"StatusCreated":              201,
	"StatusAccepted":             202,
	"StatusNonAuthoritativeInfo": 203,
	"StatusNoContent":            204,
	"StatusResetContent":         205,
	"StatusPartialContent":       206,
	"StatusMultiStatus":          207,
	"StatusAlreadyReported":      208,
	"StatusIMUsed":               226,

	"StatusMultipleChoices":   300,
	"StatusMovedPermanently":  301,
	"StatusFound":             302,
	"StatusSeeOther":          303,
	"StatusNotModified":       304,
	"StatusUseProxy":          305,
	"StatusTemporaryRedirect": 307,
	"StatusPermanentRedirect": 308,

	"StatusBadRequest":                   400,
	"StatusUnauthorized":                 401,
	"StatusPaymentRequired":              402,
	"StatusForbidden":                    403,
	"StatusNotFound":                     404,
	"StatusMethodNotAllowed":             405,
	"StatusNotAcceptable":                406,
	"StatusProxyAuthRequired":            407,
	"StatusRequestTimeout":               408,
	"StatusConflict":                     409,
	"StatusGone":                         410,
	"StatusLengthRequired":               411,
	"StatusPreconditionFailed":           412,
	"StatusRequestEntityTooLarge":        413,
	"StatusRequestURITooLong":            414,
	"StatusUnsupportedMediaType":         415,
	"StatusRequestedRangeNotSatisfiable": 416,
	"StatusExpectationFailed":            417,
	"StatusTeapot":                       418,
	"StatusMisdirectedRequest":           421,
	"StatusUnprocessableEntity":          422,
	"StatusLocked":                       423,
	"StatusFailedDependency":             424,
	"StatusTooEarly":                     425,
	"StatusUpgradeRequired":              426,
	"StatusPreconditionRequired":         428,
	"StatusTooManyRequests":              429,
	"StatusRequestHeaderFieldsTooLarge":  431,
	"StatusUnavailableForLegalReasons":   451,

	"StatusInternalServerError":           500,
	"StatusNotImplemented":                501,
	"StatusBadGateway":                    502,
	"StatusServiceUnavailable":            503,
	"StatusGatewayTimeout":                504,
	"StatusHTTPVersionNotSupported":       505,
	"StatusVariantAlsoNegotiates":         506,
	"StatusInsufficientStorage":           507,
	"StatusLoopDetected":                  508,
	"StatusNotExtended":                   510,
	"StatusNetworkAuthenticationRequired": 511,
}

HTTPStatusByName maps HTTP status code names to their numeric values.

Functions

func DefaultPackageName

func DefaultPackageName(pkgPath string) string

DefaultPackageName returns the default package name for an package path (last non-version segment)

func DrawTrackerTree

func DrawTrackerTree(nodes []TrackerNodeInterface) string

DrawTrackerTree generates a Mermaid graph for the tracker tree.

func ExportCallGraphCytoscapeJSON

func ExportCallGraphCytoscapeJSON(meta *metadata.Metadata, outputPath string) error

ExportCallGraphCytoscapeJSON exports call graph Cytoscape data as JSON file.

func ExportCytoscapeJSON

func ExportCytoscapeJSON(nodes []TrackerNodeInterface, outputPath string) error

ExportCytoscapeJSON exports Cytoscape data as JSON file.

func GenerateCallGraphCytoscapeHTML

func GenerateCallGraphCytoscapeHTML(meta *metadata.Metadata, outputPath string) error

GenerateCallGraphCytoscapeHTML generates an HTML file with Cytoscape.js visualization using call graph data.

func GenerateCytoscapeHTML

func GenerateCytoscapeHTML(nodes []TrackerNodeInterface, outputPath string) error

GenerateCytoscapeHTML generates an HTML file with Cytoscape.js visualization. The HTML template is loaded from cytoscape_template.html in the same directory.

func GenerateOptimizedCallGraphHTML

func GenerateOptimizedCallGraphHTML(meta *metadata.Metadata, outputPath string, optimizationType string) error

GenerateOptimizedCallGraphHTML generates an optimized HTML file for large call graphs

func GeneratePaginatedCytoscapeHTML

func GeneratePaginatedCytoscapeHTML(meta *metadata.Metadata, outputPath string, _ int) error

GeneratePaginatedCytoscapeHTML generates HTML with pagination support

func GenerateServerBasedCytoscapeHTML

func GenerateServerBasedCytoscapeHTML(serverURL, outputPath string) error

GenerateServerBasedCytoscapeHTML generates HTML that connects to a diagram server

func RecoverFromPanic

func RecoverFromPanic(t *testing.T, testName string)

RecoverFromPanic is a helper function that recovers from panics and provides better error reporting, especially for stack overflow scenarios. This function should be used in defer statements to catch panics in tests and make them fail gracefully instead of crashing the test runner.

Usage:

defer RecoverFromPanic(t, "TestName")

func RunWithPanicRecovery

func RunWithPanicRecovery(t *testing.T, testName string, testFunc func())

RunWithPanicRecovery runs a test function with panic recovery. This is useful for tests that might panic due to stack overflow or other issues.

Usage:

RunWithPanicRecovery(t, "TestName", func() {
    // test code that might panic
})

Types

type APISpecConfig

type APISpecConfig struct {
	// Use short names for operationIds and schema names (strip module path).
	// nil = true (default). Set to false to retain fully-qualified names.
	ShortNames *bool `yaml:"shortNames,omitempty"`

	// Framework-specific patterns
	Framework FrameworkConfig `yaml:"framework"`

	// Type mappings
	TypeMapping []TypeMapping `yaml:"typeMapping"`

	// External types that should be treated as known
	ExternalTypes []ExternalType `yaml:"externalTypes"`

	// Manual overrides
	Overrides []Override `yaml:"overrides"`

	// Include/exclude filters
	Include IncludeExclude `yaml:"include"`
	Exclude IncludeExclude `yaml:"exclude"`

	// Defaults
	Defaults Defaults `yaml:"defaults"`

	// OpenAPI metadata
	Info            Info                      `yaml:"info"`
	Servers         []Server                  `yaml:"servers"`
	Security        []SecurityRequirement     `yaml:"security"`
	SecuritySchemes map[string]SecurityScheme `yaml:"securitySchemes"`
	Tags            []Tag                     `yaml:"tags"`
	ExternalDocs    *ExternalDocumentation    `yaml:"externalDocs"`
}

APISpecConfig is the main configuration struct

func DefaultAPISpecConfig

func DefaultAPISpecConfig() *APISpecConfig

DefaultAPISpecConfig returns a default configuration

func DefaultChiConfig

func DefaultChiConfig() *APISpecConfig

DefaultChiConfig returns a default configuration for Chi router

func DefaultEchoConfig

func DefaultEchoConfig() *APISpecConfig

DefaultEchoConfig returns a default configuration for Echo framework

func DefaultFiberConfig

func DefaultFiberConfig() *APISpecConfig

DefaultFiberConfig returns a default configuration for Fiber framework

func DefaultGinConfig

func DefaultGinConfig() *APISpecConfig

DefaultGinConfig returns a default configuration for Gin framework

func DefaultHTTPConfig

func DefaultHTTPConfig() *APISpecConfig

DefaultHTTPConfig returns a default configuration for net/http

func DefaultMuxConfig

func DefaultMuxConfig() *APISpecConfig

DefaultMuxConfig returns a default configuration for Gorilla Mux framework

func LoadAPISpecConfig

func LoadAPISpecConfig(path string) (*APISpecConfig, error)

LoadAPISpecConfig loads a APISpecConfig from a YAML file

func (*APISpecConfig) ShouldIncludeFile

func (c *APISpecConfig) ShouldIncludeFile(filePath string) bool

ShouldIncludeFile checks if a file should be included based on include/exclude filters

func (*APISpecConfig) ShouldIncludeFunction

func (c *APISpecConfig) ShouldIncludeFunction(funcName string) bool

ShouldIncludeFunction checks if a function should be included based on include/exclude filters

func (*APISpecConfig) ShouldIncludePackage

func (c *APISpecConfig) ShouldIncludePackage(pkgPath string) bool

ShouldIncludePackage checks if a package should be included based on include/exclude filters

func (*APISpecConfig) ShouldIncludeType

func (c *APISpecConfig) ShouldIncludeType(typeName string) bool

ShouldIncludeType checks if a type should be included based on include/exclude filters

func (*APISpecConfig) UseShortNames

func (c *APISpecConfig) UseShortNames() bool

UseShortNames returns true if short names should be used (default when nil).

type ArgumentType

type ArgumentType int

ArgumentType represents the classification of an argument

const (
	ArgTypeDirectCallee ArgumentType = iota // Direct function call (existing callee)
	ArgTypeFunctionCall                     // Function call as argument
	ArgTypeVariable                         // Variable reference
	ArgTypeLiteral                          // Literal value
	ArgTypeSelector                         // Field/method selector
	ArgTypeComplex                          // Complex expression
	ArgTypeUnary                            // Unary expression (*ptr, &val)
	ArgTypeBinary                           // Binary expression (a + b)
	ArgTypeIndex                            // Index expression (arr[i])
	ArgTypeComposite                        // Composite literal (struct{})
	ArgTypeTypeAssert                       // Type assertion (val.(type))
)

func (ArgumentType) String

func (at ArgumentType) String() string

String returns the string representation of ArgumentType

type BasePattern

type BasePattern struct {
	CallRegex              string   `yaml:"callRegex,omitempty"`
	FunctionNameRegex      string   `yaml:"functionNameRegex,omitempty"`
	RecvType               string   `yaml:"recvType,omitempty"`
	RecvTypeRegex          string   `yaml:"recvTypeRegex,omitempty"`
	CallerPkgPatterns      []string `yaml:"callerPkgPatterns,omitempty"`
	CallerRecvTypePatterns []string `yaml:"callerRecvTypePatterns,omitempty"`
	CalleePkgPatterns      []string `yaml:"calleePkgPatterns,omitempty"`
	CalleeRecvTypePatterns []string `yaml:"calleeRecvTypePatterns,omitempty"`
}

BasePattern contains the shared matching fields used by all pattern types.

type BasePatternMatcher

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

BasePatternMatcher provides common functionality for all pattern matchers

func NewBasePatternMatcher

func NewBasePatternMatcher(cfg *APISpecConfig, contextProvider ContextProvider, typeResolver TypeResolver) *BasePatternMatcher

NewBasePatternMatcher creates a new base pattern matcher

type CallPathInfo

type CallPathInfo struct {
	CallerPkg     string            `json:"caller_pkg,omitempty"`
	CallerName    string            `json:"caller_name,omitempty"`
	Position      string            `json:"position,omitempty"`
	ParamValues   []string          `json:"param_values,omitempty"`
	GenericValues map[string]string `json:"generic_values,omitempty"`
	// Enhanced FuncLit information
	FuncLitInfo *FuncLitInfo `json:"func_lit_info,omitempty"`
}

CallPathInfo represents information for a specific call path

type Components

type Components struct {
	Schemas         map[string]*Schema        `yaml:"schemas,omitempty" json:"schemas,omitempty"`
	Responses       map[string]*Response      `yaml:"responses,omitempty" json:"responses,omitempty"`
	Parameters      map[string]*Parameter     `yaml:"parameters,omitempty" json:"parameters,omitempty"`
	Examples        map[string]*Example       `yaml:"examples,omitempty" json:"examples,omitempty"`
	RequestBodies   map[string]*RequestBody   `yaml:"requestBodies,omitempty" json:"requestBodies,omitempty"`
	Headers         map[string]*Header        `yaml:"headers,omitempty" json:"headers,omitempty"`
	SecuritySchemes map[string]SecurityScheme `yaml:"securitySchemes,omitempty" json:"securitySchemes,omitempty"`
	Links           map[string]*Link          `yaml:"links,omitempty" json:"links,omitempty"`
	Callbacks       map[string]interface{}    `yaml:"callbacks,omitempty" json:"callbacks,omitempty"`
}

Components represents OpenAPI components

type Contact

type Contact struct {
	Name  string `yaml:"name,omitempty" json:"name,omitempty"`
	URL   string `yaml:"url,omitempty" json:"url,omitempty"`
	Email string `yaml:"email,omitempty" json:"email,omitempty"`
}

Contact represents contact information

type ContentTypePattern

type ContentTypePattern struct {
	BasePattern         `yaml:",inline"`
	HeaderNameArgIndex  int `yaml:"headerNameArgIndex,omitempty"`
	HeaderValueArgIndex int `yaml:"headerValueArgIndex,omitempty"`
}

ContentTypePattern defines how to extract Content-Type from header calls.

type ContextProvider

type ContextProvider interface {
	// GetString gets a string from the string pool
	GetString(idx int) string

	// GetCalleeInfo gets callee information from a node
	GetCalleeInfo(node TrackerNodeInterface) (name, pkg, recvType string)

	// GetArgumentInfo gets argument information
	GetArgumentInfo(arg *metadata.CallArgument) string
}

ContextProvider defines the interface for providing context information

type ContextProviderImpl

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

ContextProviderImpl implements ContextProvider

func NewContextProvider

func NewContextProvider(meta *metadata.Metadata) *ContextProviderImpl

NewContextProvider creates a new context provider

func (*ContextProviderImpl) GetArgumentInfo

func (c *ContextProviderImpl) GetArgumentInfo(arg *metadata.CallArgument) string

GetArgumentInfo gets argument information as a string

func (*ContextProviderImpl) GetCalleeInfo

func (c *ContextProviderImpl) GetCalleeInfo(node TrackerNodeInterface) (name, pkg, recvType string)

GetCalleeInfo gets callee information from a node

func (*ContextProviderImpl) GetString

func (c *ContextProviderImpl) GetString(idx int) string

GetString gets a string from the string pool

type CytoscapeData

type CytoscapeData struct {
	Nodes []CytoscapeNode `json:"nodes"`
	Edges []CytoscapeEdge `json:"edges"`
}

CytoscapeData represents the data structure for Cytoscape.js and related node/edge types.

func DrawCallGraphCytoscape

func DrawCallGraphCytoscape(meta *metadata.Metadata) *CytoscapeData

DrawCallGraphCytoscape generates Cytoscape.js JSON data directly from call graph metadata.

func DrawTrackerTreeCytoscape

func DrawTrackerTreeCytoscape(nodes []TrackerNodeInterface) *CytoscapeData

DrawTrackerTreeCytoscape generates Cytoscape.js JSON data for the tracker tree.

func DrawTrackerTreeCytoscapeWithMetadata

func DrawTrackerTreeCytoscapeWithMetadata(nodes []TrackerNodeInterface, meta *metadata.Metadata) *CytoscapeData

DrawTrackerTreeCytoscapeWithMetadata generates Cytoscape.js JSON data for the tracker tree with metadata.

type CytoscapeEdge

type CytoscapeEdge struct {
	Data CytoscapeEdgeData `json:"data"`
}

type CytoscapeEdgeData

type CytoscapeEdgeData struct {
	ID          string `json:"id"`
	Source      string `json:"source"`
	Target      string `json:"target"`
	Label       string `json:"label,omitempty"`
	Type        string `json:"type,omitempty"`
	BranchKind  string `json:"branch_kind,omitempty"`  // "if-then", "if-else", "switch-case", ""
	BranchLabel string `json:"branch_label,omitempty"` // e.g. "GET", "POST" for switch cases
}

type CytoscapeNode

type CytoscapeNode struct {
	Data CytoscapeNodeData `json:"data"`
}

func OrderTrackerTreeNodesDepthFirst

func OrderTrackerTreeNodesDepthFirst(data *CytoscapeData) []CytoscapeNode

OrderTrackerTreeNodesDepthFirst orders Cytoscape nodes from a tracker tree in depth-first order starting from root nodes (main function) down to leaves, across all branches

func TraverseTrackerTreeBranchOrder

func TraverseTrackerTreeBranchOrder(data *CytoscapeData) []CytoscapeNode

TraverseTrackerTreeBranchOrder returns nodes in branch-first order: Complete one branch (with all sub-branches) depth-first before moving to next branch. Each node appears exactly once in the order.

type CytoscapeNodeData

type CytoscapeNodeData struct {
	ID       string `json:"id"`
	Label    string `json:"label"`
	Parent   string `json:"parent,omitempty"`
	Group    string `json:"group,omitempty"`
	Position string `json:"position,omitempty"`
	Type     string `json:"type,omitempty"`
	Depth    int    `json:"depth,omitempty"` // Depth level in the tree (0 = root)

	// Enhanced data for popup display
	Package          string            `json:"package,omitempty"`
	CallPaths        []CallPathInfo    `json:"call_paths,omitempty"`
	Generics         map[string]string `json:"generics,omitempty"`
	FunctionName     string            `json:"function_name,omitempty"`
	ReceiverType     string            `json:"receiver_type,omitempty"`
	IsParentFunction string            `json:"is_parent_function,omitempty"`
	Scope            string            `json:"scope,omitempty"`

	// Additional function metadata
	SignatureStr string `json:"signature_str,omitempty"`

	// Tracker tree specific data
	ArgType         string         `json:"arg_type,omitempty"`
	ArgIndex        int            `json:"arg_index,omitempty"`
	ArgContext      string         `json:"arg_context,omitempty"`
	ArgName         string         `json:"arg_name,omitempty"`
	ArgValue        string         `json:"arg_value,omitempty"`
	ArgResolvedType string         `json:"arg_resolved_type,omitempty"`
	RootAssignments map[string]int `json:"root_assignments,omitempty"`
}

type Defaults

type Defaults struct {
	RequestContentType  string `yaml:"requestContentType,omitempty"`
	ResponseContentType string `yaml:"responseContentType,omitempty"`
	ResponseStatus      int    `yaml:"responseStatus,omitempty"`
}

Defaults provides default values

type DetectedSecurityScheme added in v0.4.12

type DetectedSecurityScheme struct {
	Name   string
	Scheme SecurityScheme
}

DetectedSecurityScheme captures the result of scanning a handler's call graph for an Authorization-header check. Name is the chosen schema key (under components.securitySchemes); Scheme is the inferred shape.

type Discriminator

type Discriminator struct {
	PropertyName string            `yaml:"propertyName" json:"propertyName"`
	Mapping      map[string]string `yaml:"mapping,omitempty" json:"mapping,omitempty"`
}

Discriminator represents an OpenAPI discriminator

type Encoding

type Encoding struct {
	ContentType   string            `yaml:"contentType,omitempty" json:"contentType,omitempty"`
	Headers       map[string]Header `yaml:"headers,omitempty" json:"headers,omitempty"`
	Style         string            `yaml:"style,omitempty" json:"style,omitempty"`
	Explode       bool              `yaml:"explode,omitempty" json:"explode,omitempty"`
	AllowReserved bool              `yaml:"allowReserved,omitempty" json:"allowReserved,omitempty"`
}

Encoding represents an OpenAPI encoding

type EnumConstant

type EnumConstant struct {
	Name     string
	Type     string
	Resolved string
	Value    interface{}
	Group    int
}

EnumConstant represents a constant that might be part of an enum

type Example

type Example struct {
	Summary       string      `yaml:"summary,omitempty" json:"summary,omitempty"`
	Description   string      `yaml:"description,omitempty" json:"description,omitempty"`
	Value         interface{} `yaml:"value,omitempty" json:"value,omitempty"`
	ExternalValue string      `yaml:"externalValue,omitempty" json:"externalValue,omitempty"`
}

Example represents an OpenAPI example

type ExternalDocumentation

type ExternalDocumentation struct {
	Description string `yaml:"description,omitempty" json:"description,omitempty"`
	URL         string `yaml:"url" json:"url"`
}

ExternalDocumentation represents external documentation

type ExternalType

type ExternalType struct {
	Name        string  `yaml:"name"`        // Full type name (e.g., "primitive.ObjectID")
	OpenAPIType *Schema `yaml:"openapiType"` // OpenAPI schema for this type
	Description string  `yaml:"description,omitempty"`
}

ExternalType defines an external type that should be treated as known

type ExtractionCallback

type ExtractionCallback func(node TrackerNodeInterface, route *RouteInfo)

ExtractionCallback is called for each node during unified tree visitor traversal.

type Extractor

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

Extractor provides a cleaner, more modular approach to extraction

func NewExtractor

func NewExtractor(tree TrackerTreeInterface, cfg *APISpecConfig) *Extractor

NewExtractor creates a new refactored extractor

func (*Extractor) ExtractRoutes

func (e *Extractor) ExtractRoutes() []*RouteInfo

ExtractRoutes extracts all routes from the tracker tree

type FrameworkConfig

type FrameworkConfig struct {
	// Route extraction patterns
	RoutePatterns []RoutePattern `yaml:"routePatterns"`

	// Request body extraction patterns
	RequestBodyPatterns []RequestBodyPattern `yaml:"requestBodyPatterns"`

	// Response extraction patterns
	ResponsePatterns []ResponsePattern `yaml:"responsePatterns"`

	// Parameter extraction patterns
	ParamPatterns []ParamPattern `yaml:"paramPatterns"`

	// Mount/subrouter patterns
	MountPatterns []MountPattern `yaml:"mountPatterns"`

	// Content-Type extraction patterns (matches Header().Set("Content-Type", value))
	ContentTypePatterns []ContentTypePattern `yaml:"contentTypePatterns,omitempty"`
}

FrameworkConfig defines framework-specific extraction patterns

type FuncLitInfo

type FuncLitInfo struct {
	Position  string `json:"position,omitempty"`
	Package   string `json:"package,omitempty"`
	Signature string `json:"signature,omitempty"`
}

type GeneratorConfig

type GeneratorConfig struct {
	OpenAPIVersion string `yaml:"openapiVersion"`
	Title          string `yaml:"title"`
	APIVersion     string `yaml:"apiVersion"`
}

GeneratorConfig holds generation configuration

type Header struct {
	Description string      `yaml:"description,omitempty" json:"description,omitempty"`
	Schema      *Schema     `yaml:"schema,omitempty" json:"schema,omitempty"`
	Example     interface{} `yaml:"example,omitempty" json:"example,omitempty"`
}

Header represents an OpenAPI header

type IncludeExclude

type IncludeExclude struct {
	Files     []string `yaml:"files"`
	Packages  []string `yaml:"packages"`
	Functions []string `yaml:"functions"`
	Types     []string `yaml:"types"`
}

IncludeExclude defines what to include/exclude

func (*IncludeExclude) ShouldExcludeFile

func (ie *IncludeExclude) ShouldExcludeFile(filePath string) bool

ShouldExcludeFile checks if a file should be excluded based on exclude patterns

func (*IncludeExclude) ShouldExcludeFunction

func (ie *IncludeExclude) ShouldExcludeFunction(funcName string) bool

ShouldExcludeFunction checks if a function should be excluded based on exclude patterns

func (*IncludeExclude) ShouldExcludePackage

func (ie *IncludeExclude) ShouldExcludePackage(pkgPath string) bool

ShouldExcludePackage checks if a package should be excluded based on exclude patterns

func (*IncludeExclude) ShouldExcludeType

func (ie *IncludeExclude) ShouldExcludeType(typeName string) bool

ShouldExcludeType checks if a type should be excluded based on exclude patterns

func (*IncludeExclude) ShouldIncludeFile

func (ie *IncludeExclude) ShouldIncludeFile(filePath string) bool

ShouldIncludeFile checks if a file should be included based on include/exclude patterns

func (*IncludeExclude) ShouldIncludeFunction

func (ie *IncludeExclude) ShouldIncludeFunction(funcName string) bool

ShouldIncludeFunction checks if a function should be included based on include/exclude patterns

func (*IncludeExclude) ShouldIncludePackage

func (ie *IncludeExclude) ShouldIncludePackage(pkgPath string) bool

ShouldIncludePackage checks if a package should be included based on include/exclude patterns

func (*IncludeExclude) ShouldIncludeType

func (ie *IncludeExclude) ShouldIncludeType(typeName string) bool

ShouldIncludeType checks if a type should be included based on include/exclude patterns

type Info

type Info struct {
	Title          string   `yaml:"title,omitempty" json:"title,omitempty"`
	TermsOfService string   `yaml:"termsOfService,omitempty" json:"termsOfService,omitempty"`
	Description    string   `yaml:"description,omitempty" json:"description,omitempty"`
	Version        string   `yaml:"version" json:"version"`
	Contact        *Contact `yaml:"contact,omitempty" json:"contact,omitempty"`
	License        *License `yaml:"license,omitempty" json:"license,omitempty"`
}

Info represents the OpenAPI info object

type License

type License struct {
	Name string `yaml:"name" json:"name"`
	URL  string `yaml:"url,omitempty" json:"url,omitempty"`
}

License represents license information

type Link struct {
	OperationRef string                 `yaml:"operationRef,omitempty" json:"operationRef,omitempty"`
	OperationID  string                 `yaml:"operationId,omitempty" json:"operationId,omitempty"`
	Parameters   map[string]interface{} `yaml:"parameters,omitempty" json:"parameters,omitempty"`
	RequestBody  interface{}            `yaml:"requestBody,omitempty" json:"requestBody,omitempty"`
	Description  string                 `yaml:"description,omitempty" json:"description,omitempty"`
	Server       *Server                `yaml:"server,omitempty" json:"server,omitempty"`
}

Link represents an OpenAPI link

type MediaType

type MediaType struct {
	Schema   *Schema             `yaml:"schema,omitempty" json:"schema,omitempty"`
	Example  interface{}         `yaml:"example,omitempty" json:"example,omitempty"`
	Examples map[string]Example  `yaml:"examples,omitempty" json:"examples,omitempty"`
	Encoding map[string]Encoding `yaml:"encoding,omitempty" json:"encoding,omitempty"`
}

MediaType represents an OpenAPI media type

type MethodExtractionConfig

type MethodExtractionConfig struct {
	// Method mappings from function names
	MethodMappings []MethodMapping `yaml:"methodMappings,omitempty"`

	// Extraction strategy
	UsePrefix     bool `yaml:"usePrefix,omitempty"`     // Check for prefix matches (getUser -> GET)
	UseContains   bool `yaml:"useContains,omitempty"`   // Check for contains matches (userGet -> GET)
	CaseSensitive bool `yaml:"caseSensitive,omitempty"` // Case sensitive matching

	// Fallback behavior
	DefaultMethod    string `yaml:"defaultMethod,omitempty"`    // Default method when none found
	InferFromContext bool   `yaml:"inferFromContext,omitempty"` // Try to infer from call context
}

MethodExtractionConfig defines how to extract HTTP methods

func DefaultMethodExtractionConfig

func DefaultMethodExtractionConfig() *MethodExtractionConfig

DefaultMethodExtractionConfig returns a default method extraction configuration

type MethodMapping

type MethodMapping struct {
	Patterns []string `yaml:"patterns,omitempty"` // Function name patterns (e.g., ["get", "list", "show"])
	Method   string   `yaml:"method,omitempty"`   // HTTP method (e.g., "GET")
	Priority int      `yaml:"priority,omitempty"` // Higher priority = checked first
}

MethodMapping defines how to extract HTTP methods from function names

type MockTrackerTree

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

MockTrackerTree is a mock implementation of TrackerTreeInterface for testing

func NewMockTrackerTree

func NewMockTrackerTree(meta *metadata.Metadata, limits metadata.TrackerLimits) *MockTrackerTree

NewMockTrackerTree creates a new mock tracker tree

func (*MockTrackerTree) AddRoot

func (m *MockTrackerTree) AddRoot(root *TrackerNode)

AddRoot adds a root node to the mock tracker

func (*MockTrackerTree) FindNodeByKey

func (m *MockTrackerTree) FindNodeByKey(key string) TrackerNodeInterface

FindNodeByKey finds a node by its key in the mock tree

func (*MockTrackerTree) GetFunctionContext

func (m *MockTrackerTree) GetFunctionContext(functionName string) (*metadata.Function, string, string)

GetFunctionContext returns function context information for a function name

func (*MockTrackerTree) GetLimits

func (m *MockTrackerTree) GetLimits() metadata.TrackerLimits

GetLimits returns the tracker limits

func (*MockTrackerTree) GetMetadata

func (m *MockTrackerTree) GetMetadata() *metadata.Metadata

GetMetadata returns the underlying metadata

func (*MockTrackerTree) GetNodeCount

func (m *MockTrackerTree) GetNodeCount() int

GetNodeCount returns the total number of nodes in the mock tree

func (*MockTrackerTree) GetRoots

func (m *MockTrackerTree) GetRoots() []TrackerNodeInterface

GetRoots returns the root nodes of the mock tracker tree

func (*MockTrackerTree) TraverseTree

func (m *MockTrackerTree) TraverseTree(visitor func(node TrackerNodeInterface) bool)

TraverseTree traverses the mock tree with a visitor function

type MountInfo

type MountInfo struct {
	Path       string
	RouterArg  *metadata.CallArgument
	Assignment *metadata.CallArgument
	Pattern    MountPattern
}

MountInfo represents extracted mount information

type MountPattern

type MountPattern struct {
	BasePattern `yaml:",inline"`

	// Argument extraction hints
	PathArgIndex   int `yaml:"pathArgIndex,omitempty"`   // Which arg contains mount path
	RouterArgIndex int `yaml:"routerArgIndex,omitempty"` // Which arg contains router

	// Extraction hints
	PathFromArg   bool `yaml:"pathFromArg,omitempty"`   // Extract path from argument
	RouterFromArg bool `yaml:"routerFromArg,omitempty"` // Extract router from argument
	IsMount       bool `yaml:"isMount,omitempty"`       // This is a mount operation
}

MountPattern defines how to extract mount/subrouter information

type MountPatternMatcher

type MountPatternMatcher interface {
	PatternMatcher

	// ExtractMount extracts mount information from a matched node
	ExtractMount(node TrackerNodeInterface) MountInfo
}

MountPatternMatcher matches mount patterns

type MountPatternMatcherImpl

type MountPatternMatcherImpl struct {
	*BasePatternMatcher
	// contains filtered or unexported fields
}

MountPatternMatcherImpl implements MountPatternMatcher

func NewMountPatternMatcher

func NewMountPatternMatcher(pattern MountPattern, cfg *APISpecConfig, contextProvider ContextProvider, typeResolver TypeResolver) *MountPatternMatcherImpl

NewMountPatternMatcher creates a new mount pattern matcher

func (*MountPatternMatcherImpl) ExtractMount

ExtractMount extracts mount information from a matched node

func (*MountPatternMatcherImpl) GetPattern

func (m *MountPatternMatcherImpl) GetPattern() interface{}

GetPattern returns the mount pattern

func (*MountPatternMatcherImpl) GetPriority

func (m *MountPatternMatcherImpl) GetPriority() int

GetPriority returns the priority of this pattern

func (*MountPatternMatcherImpl) MatchNode

MatchNode checks if a node matches the mount pattern

type OAuthFlow

type OAuthFlow struct {
	AuthorizationURL string            `yaml:"authorizationUrl,omitempty" json:"authorizationUrl,omitempty"`
	TokenURL         string            `yaml:"tokenUrl,omitempty" json:"tokenUrl,omitempty"`
	RefreshURL       string            `yaml:"refreshUrl,omitempty" json:"refreshUrl,omitempty"`
	Scopes           map[string]string `yaml:"scopes" json:"scopes"`
}

OAuthFlow represents an OAuth flow

type OAuthFlows

type OAuthFlows struct {
	Implicit          *OAuthFlow `yaml:"implicit,omitempty" json:"implicit,omitempty"`
	Password          *OAuthFlow `yaml:"password,omitempty" json:"password,omitempty"`
	ClientCredentials *OAuthFlow `yaml:"clientCredentials,omitempty" json:"clientCredentials,omitempty"`
	AuthorizationCode *OAuthFlow `yaml:"authorizationCode,omitempty" json:"authorizationCode,omitempty"`
}

OAuthFlows represents OAuth flows

type OpenAPISpec

type OpenAPISpec struct {
	OpenAPI      string                 `yaml:"openapi" json:"openapi"`
	Info         Info                   `yaml:"info,omitempty" json:"info,omitempty"`
	Servers      []Server               `yaml:"servers,omitempty" json:"servers,omitempty"`
	Paths        map[string]PathItem    `yaml:"paths" json:"paths"`
	Components   *Components            `yaml:"components,omitempty" json:"components,omitempty"`
	Security     []SecurityRequirement  `yaml:"security,omitempty" json:"security,omitempty"`
	Tags         []Tag                  `yaml:"tags,omitempty" json:"tags,omitempty"`
	ExternalDocs *ExternalDocumentation `yaml:"externalDocs,omitempty" json:"externalDocs,omitempty"`
}

OpenAPISpec represents the root OpenAPI specification

func MapMetadataToOpenAPI

func MapMetadataToOpenAPI(tree TrackerTreeInterface, cfg *APISpecConfig, genCfg GeneratorConfig) (*OpenAPISpec, error)

MapMetadataToOpenAPI maps metadata to OpenAPI specification

type Operation

type Operation struct {
	Tags         []string               `yaml:"tags,omitempty" json:"tags,omitempty"`
	Summary      string                 `yaml:"summary,omitempty" json:"summary,omitempty"`
	Description  string                 `yaml:"description,omitempty" json:"description,omitempty"`
	OperationID  string                 `yaml:"operationId,omitempty" json:"operationId,omitempty"`
	Parameters   []Parameter            `yaml:"parameters,omitempty" json:"parameters,omitempty"`
	RequestBody  *RequestBody           `yaml:"requestBody,omitempty" json:"requestBody,omitempty"`
	Responses    map[string]Response    `yaml:"responses" json:"responses"`
	Security     []SecurityRequirement  `yaml:"security,omitempty" json:"security,omitempty"`
	ExternalDocs *ExternalDocumentation `yaml:"externalDocs,omitempty" json:"externalDocs,omitempty"`
}

Operation represents an OpenAPI operation

type Override

type Override struct {
	FunctionName   string   `yaml:"functionName"`
	Summary        string   `yaml:"summary,omitempty"`
	Description    string   `yaml:"description,omitempty"`
	ResponseStatus int      `yaml:"responseStatus,omitempty"`
	ResponseType   string   `yaml:"responseType,omitempty"`
	Tags           []string `yaml:"tags,omitempty"`
}

Override provides manual overrides for specific functions

type OverrideApplier

type OverrideApplier interface {
	// ApplyOverrides applies manual overrides to route info
	ApplyOverrides(routeInfo *RouteInfo)

	// HasOverride checks if there's an override for a function
	HasOverride(functionName string) bool
}

OverrideApplier defines the interface for applying overrides

type OverrideApplierImpl

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

OverrideApplierImpl implements OverrideApplier

func NewOverrideApplier

func NewOverrideApplier(cfg *APISpecConfig) *OverrideApplierImpl

NewOverrideApplier creates a new override applier

func (*OverrideApplierImpl) ApplyOverrides

func (o *OverrideApplierImpl) ApplyOverrides(routeInfo *RouteInfo)

ApplyOverrides applies manual overrides to route info

func (*OverrideApplierImpl) HasOverride

func (o *OverrideApplierImpl) HasOverride(functionName string) bool

HasOverride checks if there's an override for a function

type PaginatedCallGraphServer

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

PaginatedCallGraphServer creates an HTTP server for serving paginated call graph data

func NewPaginatedCallGraphServer

func NewPaginatedCallGraphServer(meta *metadata.Metadata, pageSize int) *PaginatedCallGraphServer

NewPaginatedCallGraphServer creates a new paginated server

func (*PaginatedCallGraphServer) ServeHTTP

ServeHTTP implements http.Handler

type PaginatedCytoscapeData

type PaginatedCytoscapeData struct {
	Nodes      []CytoscapeNode `json:"nodes"`
	Edges      []CytoscapeEdge `json:"edges"`
	TotalNodes int             `json:"total_nodes"`
	TotalEdges int             `json:"total_edges"`
	Page       int             `json:"page"`
	PageSize   int             `json:"page_size"`
	HasMore    bool            `json:"has_more"`
}

PaginatedCytoscapeData represents paginated data for Cytoscape.js

type ParamPattern

type ParamPattern struct {
	BasePattern `yaml:",inline"`

	// Parameter location and extraction
	ParamIn       string `yaml:"paramIn,omitempty"`       // path, query, header, cookie
	ParamArgIndex int    `yaml:"paramArgIndex,omitempty"` // Which arg contains parameter
	TypeArgIndex  int    `yaml:"typeArgIndex,omitempty"`  // Which arg contains type info

	// Extraction hints
	TypeFromArg bool `yaml:"typeFromArg,omitempty"` // Extract type from argument
	Deref       bool `yaml:"deref,omitempty"`       // Dereference pointer types

	// Default schema hints used when TypeFromArg is false. Useful for calls
	// like r.FormFile(name) where the schema is fixed (string/binary) regardless
	// of how the result is consumed.
	DefaultType   string `yaml:"defaultType,omitempty"`
	DefaultFormat string `yaml:"defaultFormat,omitempty"`
}

ParamPattern defines how to extract parameter information

type ParamPatternMatcher

type ParamPatternMatcher interface {
	PatternMatcher

	// ExtractParam extracts parameter information from a matched node
	ExtractParam(node TrackerNodeInterface, route *RouteInfo) *Parameter
}

ParamPatternMatcher matches parameter patterns

type ParamPatternMatcherImpl

type ParamPatternMatcherImpl struct {
	*BasePatternMatcher
	// contains filtered or unexported fields
}

ParamPatternMatcherImpl implements ParamPatternMatcher

func NewParamPatternMatcher

func NewParamPatternMatcher(pattern ParamPattern, cfg *APISpecConfig, contextProvider ContextProvider, typeResolver TypeResolver) *ParamPatternMatcherImpl

NewParamPatternMatcher creates a new param pattern matcher

func (*ParamPatternMatcherImpl) ExtractParam

func (p *ParamPatternMatcherImpl) ExtractParam(node TrackerNodeInterface, route *RouteInfo) *Parameter

ExtractParam extracts parameter information from a matched node

func (*ParamPatternMatcherImpl) GetPattern

func (p *ParamPatternMatcherImpl) GetPattern() interface{}

GetPattern returns the param pattern

func (*ParamPatternMatcherImpl) GetPriority

func (p *ParamPatternMatcherImpl) GetPriority() int

GetPriority returns the priority of this pattern

func (*ParamPatternMatcherImpl) MatchNode

MatchNode checks if a node matches the param pattern

type Parameter

type Parameter struct {
	Name        string                 `yaml:"name" json:"name"`
	In          string                 `yaml:"in" json:"in"`
	Description string                 `yaml:"description,omitempty" json:"description,omitempty"`
	Required    bool                   `yaml:"required,omitempty" json:"required,omitempty"`
	Schema      *Schema                `yaml:"schema,omitempty" json:"schema,omitempty"`
	Example     interface{}            `yaml:"example,omitempty" json:"example,omitempty"`
	Extensions  map[string]interface{} `yaml:",inline" json:"Extensions,omitempty"`
}

Parameter represents an OpenAPI parameter

type Parts

type Parts struct {
	PkgName      string
	TypeName     string
	GenericTypes []string
}

func TypeParts

func TypeParts(typeName string) Parts

type PathItem

type PathItem struct {
	Ref         string      `yaml:"$ref,omitempty" json:"$ref,omitempty"`
	Summary     string      `yaml:"summary,omitempty" json:"summary,omitempty"`
	Description string      `yaml:"description,omitempty" json:"description,omitempty"`
	Get         *Operation  `yaml:"get,omitempty" json:"get,omitempty"`
	Post        *Operation  `yaml:"post,omitempty" json:"post,omitempty"`
	Put         *Operation  `yaml:"put,omitempty" json:"put,omitempty"`
	Delete      *Operation  `yaml:"delete,omitempty" json:"delete,omitempty"`
	Patch       *Operation  `yaml:"patch,omitempty" json:"patch,omitempty"`
	Options     *Operation  `yaml:"options,omitempty" json:"options,omitempty"`
	Head        *Operation  `yaml:"head,omitempty" json:"head,omitempty"`
	Parameters  []Parameter `yaml:"parameters,omitempty" json:"parameters,omitempty"`
}

PathItem represents a path item in OpenAPI

type PatternExecutor

type PatternExecutor interface {
	// ExecuteRoutePattern executes a route pattern match
	ExecuteRoutePattern(node TrackerNodeInterface) (RouteInfo, bool)

	// ExecuteMountPattern executes a mount pattern match
	ExecuteMountPattern(node TrackerNodeInterface) (MountInfo, bool)

	// ExecuteRequestPattern executes a request pattern match
	ExecuteRequestPattern(node TrackerNodeInterface, route *RouteInfo) (*RequestInfo, bool)

	// ExecuteResponsePattern executes a response pattern match
	ExecuteResponsePattern(node TrackerNodeInterface) (*ResponseInfo, bool)

	// ExecuteParamPattern executes a parameter pattern match
	ExecuteParamPattern(node TrackerNodeInterface) (*Parameter, bool)
}

PatternExecutor defines the interface for pattern execution

type PatternMatcher

type PatternMatcher interface {
	// MatchNode checks if a node matches a specific pattern
	MatchNode(node TrackerNodeInterface) bool

	// GetPattern returns the pattern that was matched
	GetPattern() interface{}

	// GetPriority returns the priority of this pattern (higher = more specific)
	GetPriority() int
}

PatternMatcher defines the interface for pattern matching operations

type RequestBody

type RequestBody struct {
	Description string               `yaml:"description,omitempty" json:"description,omitempty"`
	Content     map[string]MediaType `yaml:"content" json:"content"`
	Required    bool                 `yaml:"required,omitempty" json:"required,omitempty"`
}

RequestBody represents an OpenAPI request body

type RequestBodyPattern

type RequestBodyPattern struct {
	BasePattern `yaml:",inline"`

	// Argument extraction hints
	TypeArgIndex int `yaml:"typeArgIndex,omitempty"` // Which arg contains type info

	// Extraction hints
	TypeFromArg    bool `yaml:"typeFromArg,omitempty"`    // Extract type from argument
	TypeFromReturn bool `yaml:"typeFromReturn,omitempty"` // Extract type from return value
	Deref          bool `yaml:"deref,omitempty"`          // Dereference pointer types

	// Context-aware validation
	AllowForGetMethods bool `yaml:"allowForGetMethods,omitempty"` // Allow this pattern for GET/HEAD methods
}

RequestBodyPattern defines how to extract request body information

type RequestInfo

type RequestInfo struct {
	ContentType string
	BodyType    string
	Schema      *Schema

	// Required indicates whether the OpenAPI requestBody.required flag should be
	// set. When a request-body pattern matches (json.Decode, c.Bind, etc.) the
	// body must arrive populated — handlers that decode it are deterministic
	// 400s on empty input — so the matcher sets this true.
	Required bool

	// DecodeTargetVar is the local variable name the request body decodes
	// into (e.g., `body` in `json.NewDecoder(r.Body).Decode(&body)`). Used
	// to drive field-level converter inference: any later access to
	// `<DecodeTargetVar>.<FieldName>` consumed by a known converter back-
	// propagates schema type/format onto that struct field.
	DecodeTargetVar string
}

RequestInfo represents request information

type RequestPatternMatcher

type RequestPatternMatcher interface {
	PatternMatcher

	// ExtractRequest extracts request information from a matched node
	ExtractRequest(node TrackerNodeInterface, route *RouteInfo) *RequestInfo
}

RequestPatternMatcher matches request body patterns

type RequestPatternMatcherImpl

type RequestPatternMatcherImpl struct {
	*BasePatternMatcher
	// contains filtered or unexported fields
}

RequestPatternMatcherImpl implements RequestPatternMatcher

func NewRequestPatternMatcher

func NewRequestPatternMatcher(pattern RequestBodyPattern, cfg *APISpecConfig, contextProvider ContextProvider, typeResolver TypeResolver) *RequestPatternMatcherImpl

NewRequestPatternMatcher creates a new request pattern matcher

func (*RequestPatternMatcherImpl) ExtractRequest

func (r *RequestPatternMatcherImpl) ExtractRequest(node TrackerNodeInterface, route *RouteInfo) *RequestInfo

ExtractRequest extracts request information from a matched node

func (*RequestPatternMatcherImpl) GetPattern

func (r *RequestPatternMatcherImpl) GetPattern() interface{}

GetPattern returns the request pattern

func (*RequestPatternMatcherImpl) GetPriority

func (r *RequestPatternMatcherImpl) GetPriority() int

GetPriority returns the priority of this pattern

func (*RequestPatternMatcherImpl) MatchNode

MatchNode checks if a node matches the request pattern

type Response

type Response struct {
	Description string               `yaml:"description" json:"description"`
	Headers     map[string]Header    `yaml:"headers,omitempty" json:"headers,omitempty"`
	Content     map[string]MediaType `yaml:"content,omitempty" json:"content,omitempty"`
	Links       map[string]Link      `yaml:"links,omitempty" json:"links,omitempty"`
}

Response represents an OpenAPI response

type ResponseInfo

type ResponseInfo struct {
	StatusCode  int
	ContentType string
	BodyType    string
	Schema      *Schema
	// AlternativeSchemas holds additional schemas when multiple response
	// types share the same status code (e.g., ErrorResponse and map[string]string
	// both returned on 400). These get wrapped in oneOf during serialization.
	AlternativeSchemas []*Schema
	// Branch context from CFG analysis (nil = unconditional)
	Branch *metadata.BranchContext
}

ResponseInfo represents response information

type ResponsePattern

type ResponsePattern struct {
	BasePattern `yaml:",inline"`

	// Argument extraction hints
	StatusArgIndex int `yaml:"statusArgIndex,omitempty"` // Which arg contains status code
	TypeArgIndex   int `yaml:"typeArgIndex,omitempty"`   // Which arg contains type info

	// Extraction hints
	StatusFromArg bool `yaml:"statusFromArg,omitempty"` // Extract status from argument
	TypeFromArg   bool `yaml:"typeFromArg,omitempty"`   // Extract type from argument
	Deref         bool `yaml:"deref,omitempty"`         // Dereference pointer types
	// DefaultStatus specifies a fallback status code when it can't be extracted from args
	DefaultStatus int `yaml:"defaultStatus,omitempty"`
	// DefaultContentType overrides the config default content type when set
	DefaultContentType string `yaml:"defaultContentType,omitempty"`
	// DefaultBodyType specifies a fixed body type when the function writes a
	// response but has no type argument to extract (e.g., fmt.Fprintf → "string",
	// io.Copy → "[]byte"). Used only when TypeFromArg is false.
	DefaultBodyType string `yaml:"defaultBodyType,omitempty"`
	// ValidateWriterDest gates patterns whose write target is the FIRST argument
	// rather than the receiver — the stdlib free functions io.Copy(dst, src),
	// io.WriteString(dst, s) and fmt.Fprintf(dst, …). Receiver-based response
	// writes (w.Write, c.JSON, json.NewEncoder(w).Encode) are already constrained
	// to a response type by RecvTypeRegex; these free functions are not, so any
	// io.Copy to a file/buffer reachable in a handler's call graph would otherwise
	// be misinferred as a (binary) response body. When set, the destination arg
	// must trace to an http.ResponseWriter or the pattern produces no response
	// (issue #52, response-side counterpart of the request decode-source check).
	ValidateWriterDest bool `yaml:"validateWriterDest,omitempty"`
}

ResponsePattern defines how to extract response information

type ResponsePatternMatcher

type ResponsePatternMatcher interface {
	PatternMatcher

	// ExtractResponse extracts response information from a matched node.
	// Returns a slice because a single call site can yield multiple responses
	// when conditional status codes apply (see the implementation / issue #39).
	ExtractResponse(node TrackerNodeInterface, route *RouteInfo) []*ResponseInfo
}

ResponsePatternMatcher matches response patterns

type ResponsePatternMatcherImpl

type ResponsePatternMatcherImpl struct {
	*BasePatternMatcher
	// contains filtered or unexported fields
}

ResponsePatternMatcherImpl implements ResponsePatternMatcher

func NewResponsePatternMatcher

func NewResponsePatternMatcher(pattern ResponsePattern, cfg *APISpecConfig, contextProvider ContextProvider, typeResolver TypeResolver) *ResponsePatternMatcherImpl

NewResponsePatternMatcher creates a new response pattern matcher

func (*ResponsePatternMatcherImpl) ExtractResponse

func (r *ResponsePatternMatcherImpl) ExtractResponse(node TrackerNodeInterface, route *RouteInfo) []*ResponseInfo

ExtractResponse extracts response information from a matched node.

Returns a slice to support conditional status codes (issue #39): when the status arg is a local variable reassigned across branches with different status codes, we emit one ResponseInfo per distinct status (all sharing the same body/schema). For the typical "one status per call" case the slice has exactly one element — byte-identical to the previous single-response output.

func (*ResponsePatternMatcherImpl) GetPattern

func (r *ResponsePatternMatcherImpl) GetPattern() interface{}

GetPattern returns the response pattern

func (*ResponsePatternMatcherImpl) GetPriority

func (r *ResponsePatternMatcherImpl) GetPriority() int

GetPriority returns the priority of this pattern

func (*ResponsePatternMatcherImpl) MatchNode

MatchNode checks if a node matches the response pattern

type RouteExtractor

type RouteExtractor interface {
	// ExtractRoutes extracts all routes from the tracker tree
	ExtractRoutes() []RouteInfo

	// ExtractRouteFromNode extracts a single route from a node
	ExtractRouteFromNode(node TrackerNodeInterface, pattern RoutePattern) RouteInfo

	// TraverseForRoutes traverses the tree to find routes
	TraverseForRoutes(node TrackerNodeInterface, mountPath string, mountTags []string, routes *[]RouteInfo)
}

RouteExtractor defines the interface for route extraction operations

type RouteInfo

type RouteInfo struct {
	Path        string
	MountPath   string
	Method      string
	Handler     string
	Package     string
	File        string
	Function    string
	Summary     string
	Description string
	Tags        []string
	Request     *RequestInfo
	Response    map[string]*ResponseInfo
	Params      []Parameter

	UsedTypes map[string]*Schema
	Metadata  *metadata.Metadata

	// Resolved router group prefix (if any)
	GroupPrefix string

	// SecurityScheme, when set, names the security scheme this route uses
	// (e.g. "bearerAuth"). The scheme definition itself is held centrally
	// on the generator config — multiple routes that use the same auth
	// pattern share a single Components.securitySchemes entry. nil means
	// no auth was detected for this route.
	SecurityScheme *DetectedSecurityScheme
	// contains filtered or unexported fields
}

RouteInfo represents extracted route information

func NewRouteInfo

func NewRouteInfo() *RouteInfo

func (*RouteInfo) IsValid

func (r *RouteInfo) IsValid() bool

IsValid checks if the route info is valid

type RoutePattern

type RoutePattern struct {
	BasePattern `yaml:",inline"`

	// Argument extraction hints
	MethodArgIndex  int `yaml:"methodArgIndex,omitempty"`  // Which arg contains HTTP method
	PathArgIndex    int `yaml:"pathArgIndex,omitempty"`    // Which arg contains path
	HandlerArgIndex int `yaml:"handlerArgIndex,omitempty"` // Which arg contains handler

	// Extraction hints
	MethodFromCall    bool `yaml:"methodFromCall,omitempty"`    // Extract method from function name
	MethodFromHandler bool `yaml:"methodFromHandler,omitempty"` // Extract method from handler function name
	PathFromArg       bool `yaml:"pathFromArg,omitempty"`       // Extract path from argument
	HandlerFromArg    bool `yaml:"handlerFromArg,omitempty"`    // Extract handler from argument

	// Method extraction configuration
	MethodExtraction *MethodExtractionConfig `yaml:"methodExtraction,omitempty"`
}

RoutePattern defines how to extract route information

func (*RoutePattern) MatchFunctionName

func (p *RoutePattern) MatchFunctionName(functionName string) bool

MatchFunctionName checks if the function name regex matches

func (*RoutePattern) MatchPattern

func (p *RoutePattern) MatchPattern(pattern, value string) bool

MatchPattern checks if a pattern matches a value

type RoutePatternMatcher

type RoutePatternMatcher interface {
	PatternMatcher

	// ExtractRoute extracts route information from a matched node
	ExtractRoute(node TrackerNodeInterface, routeInfo *RouteInfo) bool
}

RoutePatternMatcher matches route patterns

type RoutePatternMatcherImpl

type RoutePatternMatcherImpl struct {
	*BasePatternMatcher
	// contains filtered or unexported fields
}

RoutePatternMatcherImpl implements RoutePatternMatcher

func NewRoutePatternMatcher

func NewRoutePatternMatcher(pattern RoutePattern, cfg *APISpecConfig, contextProvider ContextProvider, typeResolver TypeResolver) *RoutePatternMatcherImpl

NewRoutePatternMatcher creates a new route pattern matcher

func (*RoutePatternMatcherImpl) ExtractRoute

func (r *RoutePatternMatcherImpl) ExtractRoute(node TrackerNodeInterface, routeInfo *RouteInfo) bool

ExtractRoute extracts route information from a matched node

func (*RoutePatternMatcherImpl) GetPattern

func (r *RoutePatternMatcherImpl) GetPattern() interface{}

GetPattern returns the route pattern

func (*RoutePatternMatcherImpl) GetPriority

func (r *RoutePatternMatcherImpl) GetPriority() int

GetPriority returns the priority of this pattern

func (*RoutePatternMatcherImpl) MatchNode

MatchNode checks if a node matches the route pattern

type Schema

type Schema struct {
	Type                 string                 `yaml:"type,omitempty" json:"type,omitempty"`
	Format               string                 `yaml:"format,omitempty" json:"format,omitempty"`
	Description          string                 `yaml:"description,omitempty" json:"description,omitempty"`
	Title                string                 `yaml:"title,omitempty" json:"title,omitempty"`
	Default              interface{}            `yaml:"default,omitempty" json:"default,omitempty"`
	Example              interface{}            `yaml:"example,omitempty" json:"example,omitempty"`
	ReadOnly             bool                   `yaml:"readOnly,omitempty" json:"readOnly,omitempty"`
	WriteOnly            bool                   `yaml:"writeOnly,omitempty" json:"writeOnly,omitempty"`
	Deprecated           bool                   `yaml:"deprecated,omitempty" json:"deprecated,omitempty"`
	Ref                  string                 `yaml:"$ref,omitempty" json:"$ref,omitempty"`
	AllOf                []*Schema              `yaml:"allOf,omitempty" json:"allOf,omitempty"`
	OneOf                []*Schema              `yaml:"oneOf,omitempty" json:"oneOf,omitempty"`
	AnyOf                []*Schema              `yaml:"anyOf,omitempty" json:"anyOf,omitempty"`
	Not                  *Schema                `yaml:"not,omitempty" json:"not,omitempty"`
	Items                *Schema                `yaml:"items,omitempty" json:"items,omitempty"`
	Properties           map[string]*Schema     `yaml:"properties,omitempty" json:"properties,omitempty"`
	AdditionalProperties *Schema                `yaml:"additionalProperties,omitempty" json:"additionalProperties,omitempty"`
	Required             []string               `yaml:"required,omitempty" json:"required,omitempty"`
	MinLength            int                    `yaml:"minLength,omitempty" json:"minLength,omitempty"`
	MaxLength            int                    `yaml:"maxLength,omitempty" json:"maxLength,omitempty"`
	Pattern              string                 `yaml:"pattern,omitempty" json:"pattern,omitempty"`
	Minimum              *float64               `yaml:"minimum,omitempty" json:"minimum,omitempty"`
	Maximum              *float64               `yaml:"maximum,omitempty" json:"maximum,omitempty"`
	ExclusiveMinimum     bool                   `yaml:"exclusiveMinimum,omitempty" json:"exclusiveMinimum,omitempty"`
	ExclusiveMaximum     bool                   `yaml:"exclusiveMaximum,omitempty" json:"exclusiveMaximum,omitempty"`
	MultipleOf           float64                `yaml:"multipleOf,omitempty" json:"multipleOf,omitempty"`
	MinItems             int                    `yaml:"minItems,omitempty" json:"minItems,omitempty"`
	MaxItems             int                    `yaml:"maxItems,omitempty" json:"maxItems,omitempty"`
	UniqueItems          bool                   `yaml:"uniqueItems,omitempty" json:"uniqueItems,omitempty"`
	MinProperties        int                    `yaml:"minProperties,omitempty" json:"minProperties,omitempty"`
	MaxProperties        int                    `yaml:"maxProperties,omitempty" json:"maxProperties,omitempty"`
	Enum                 []interface{}          `yaml:"enum,omitempty" json:"enum,omitempty"`
	Discriminator        *Discriminator         `yaml:"discriminator,omitempty" json:"discriminator,omitempty"`
	XML                  *XML                   `yaml:"xml,omitempty" json:"xml,omitempty"`
	ExternalDocs         *ExternalDocumentation `yaml:"externalDocs,omitempty" json:"externalDocs,omitempty"`
}

Schema represents an OpenAPI schema

type SchemaMapper

type SchemaMapper interface {
	// MapGoTypeToOpenAPISchema maps a Go type to OpenAPI schema
	MapGoTypeToOpenAPISchema(goType string) *Schema

	// MapStatusCode maps a status code string to HTTP status code
	MapStatusCode(statusStr string) (int, bool)

	// MapMethodFromFunctionName extracts HTTP method from function name
	MapMethodFromFunctionName(funcName string) string
}

SchemaMapper defines the interface for schema mapping operations

type SchemaMapperImpl

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

SchemaMapperImpl implements SchemaMapper

func NewSchemaMapper

func NewSchemaMapper(cfg *APISpecConfig) *SchemaMapperImpl

NewSchemaMapper creates a new schema mapper

func (*SchemaMapperImpl) MapGoTypeToOpenAPISchema

func (s *SchemaMapperImpl) MapGoTypeToOpenAPISchema(goType string) *Schema

MapGoTypeToOpenAPISchema maps Go types to OpenAPI schemas

func (*SchemaMapperImpl) MapMethodFromFunctionName

func (s *SchemaMapperImpl) MapMethodFromFunctionName(funcName string) string

MapMethodFromFunctionName extracts HTTP method from function name

func (*SchemaMapperImpl) MapStatusCode

func (s *SchemaMapperImpl) MapStatusCode(statusStr string) (int, bool)

MapStatusCode maps a status code string to HTTP status code

type SecurityRequirement

type SecurityRequirement map[string][]string

SecurityRequirement represents a security requirement

type SecurityScheme

type SecurityScheme struct {
	Type             string      `yaml:"type" json:"type"`
	Description      string      `yaml:"description,omitempty" json:"description,omitempty"`
	Name             string      `yaml:"name,omitempty" json:"name,omitempty"`
	In               string      `yaml:"in,omitempty" json:"in,omitempty"`
	Scheme           string      `yaml:"scheme,omitempty" json:"scheme,omitempty"`
	BearerFormat     string      `yaml:"bearerFormat,omitempty" json:"bearerFormat,omitempty"`
	Flows            *OAuthFlows `yaml:"flows,omitempty" json:"flows,omitempty"`
	OpenIDConnectURL string      `yaml:"openIdConnectUrl,omitempty" json:"openIdConnectUrl,omitempty"`
}

SecurityScheme represents an OpenAPI security scheme

type Server

type Server struct {
	URL         string                    `yaml:"url" json:"url"`
	Description string                    `yaml:"description,omitempty" json:"description,omitempty"`
	Variables   map[string]ServerVariable `yaml:"variables,omitempty" json:"variables,omitempty"`
}

Server represents a server

type ServerVariable

type ServerVariable struct {
	Enum        []string `yaml:"enum,omitempty" json:"enum,omitempty"`
	Default     string   `yaml:"default" json:"default"`
	Description string   `yaml:"description,omitempty" json:"description,omitempty"`
}

ServerVariable represents a server variable

type Tag

type Tag struct {
	Name         string                 `yaml:"name" json:"name"`
	Description  string                 `yaml:"description,omitempty" json:"description,omitempty"`
	ExternalDocs *ExternalDocumentation `yaml:"externalDocs,omitempty" json:"externalDocs,omitempty"`
}

Tag represents an OpenAPI tag

type TrackerNode

type TrackerNode struct {
	Parent   *TrackerNode
	Children []*TrackerNode
	*metadata.CallGraphEdge
	*metadata.CallArgument

	// Enhanced argument classification
	ArgType    ArgumentType
	IsArgument bool
	ArgIndex   int    // Position in argument list
	ArgContext string // Context where argument is used

	RootAssignmentMap map[string][]metadata.Assignment `yaml:"root_assignments,omitempty"`
	// contains filtered or unexported fields
}

TrackerNode represents a node in the call graph tree.

func NewTrackerNode

func NewTrackerNode(tree *TrackerTree, meta *metadata.Metadata, parentID, id string, parentEdge *metadata.CallGraphEdge, callArg *metadata.CallArgument, visited map[string]int, assignmentIndex *assigmentIndexMap, limits metadata.TrackerLimits) *TrackerNode

NewTrackerNode creates a new TrackerNode for the tree.

func (*TrackerNode) AddChild

func (nd *TrackerNode) AddChild(child *TrackerNode)

func (*TrackerNode) AddChildren

func (nd *TrackerNode) AddChildren(children []*TrackerNode)

func (*TrackerNode) GetArgContext

func (nd *TrackerNode) GetArgContext() string

GetArgContext returns the argument context

func (*TrackerNode) GetArgIndex

func (nd *TrackerNode) GetArgIndex() int

GetArgIndex returns the argument index

func (*TrackerNode) GetArgType

func (nd *TrackerNode) GetArgType() metadata.ArgumentType

GetArgType returns the argument type

func (*TrackerNode) GetArgument

func (nd *TrackerNode) GetArgument() *metadata.CallArgument

GetArgument returns the call argument

func (*TrackerNode) GetChildren

func (nd *TrackerNode) GetChildren() []TrackerNodeInterface

GetChildren returns the children nodes

func (*TrackerNode) GetEdge

func (nd *TrackerNode) GetEdge() *metadata.CallGraphEdge

GetEdge returns the call graph edge

func (*TrackerNode) GetKey

func (nd *TrackerNode) GetKey() string

GetKey returns the unique key of the node

func (*TrackerNode) GetParent

func (nd *TrackerNode) GetParent() TrackerNodeInterface

GetParent returns the parent node

func (*TrackerNode) GetRootAssignmentMap

func (nd *TrackerNode) GetRootAssignmentMap() map[string][]metadata.Assignment

GetRootAssignmentMap returns the root assignment map

func (*TrackerNode) GetTypeParamMap

func (nd *TrackerNode) GetTypeParamMap() map[string]string

GetTypeParamMap returns the type parameter map

func (*TrackerNode) Key

func (nd *TrackerNode) Key() string

func (*TrackerNode) TypeParams

func (nd *TrackerNode) TypeParams() map[string]string

type TrackerNodeInterface

type TrackerNodeInterface interface {
	// GetKey returns the unique key of the node
	GetKey() string

	// GetParent returns the parent node
	GetParent() TrackerNodeInterface

	// GetChildren returns the children nodes
	GetChildren() []TrackerNodeInterface

	// GetEdge returns the call graph edge
	GetEdge() *metadata.CallGraphEdge

	// GetArgument returns the call argument
	GetArgument() *metadata.CallArgument

	// GetArgType returns the argument type
	GetArgType() metadata.ArgumentType

	// GetArgIndex returns the argument index
	GetArgIndex() int

	// GetArgContext returns the argument context
	GetArgContext() string

	// GetTypeParamMap returns the type parameter map
	GetTypeParamMap() map[string]string

	// GetRootAssignmentMap returns the root assignment map
	GetRootAssignmentMap() map[string][]metadata.Assignment
}

TrackerNodeInterface defines the interface for tracker tree nodes

type TrackerTree

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

TrackerTree represents the call graph as a tree structure.

func NewTrackerTree

func NewTrackerTree(meta *metadata.Metadata, limits metadata.TrackerLimits) *TrackerTree

NewTrackerTree constructs a TrackerTree from metadata and limits.

func (*TrackerTree) FindNodeByKey

func (t *TrackerTree) FindNodeByKey(key string) TrackerNodeInterface

FindNodeByKey finds a node by its key in the tracker tree

func (*TrackerTree) FindVariableNodes

func (t *TrackerTree) FindVariableNodes() []*TrackerNode

FindVariableNodes returns all nodes that represent variables

func (*TrackerTree) GetFunctionContext

func (t *TrackerTree) GetFunctionContext(functionName string) (*metadata.Function, string, string)

GetFunctionContext returns the *metadata.Function, package name, and file name for a function name.

func (*TrackerTree) GetInterfaceResolutions

func (t *TrackerTree) GetInterfaceResolutions() map[interfaceKey]string

GetInterfaceResolutions returns all registered interface resolutions for debugging

func (*TrackerTree) GetLimits

func (t *TrackerTree) GetLimits() metadata.TrackerLimits

GetLimits returns the tracker limits

func (*TrackerTree) GetMetadata

func (t *TrackerTree) GetMetadata() *metadata.Metadata

GetMetadata returns the underlying metadata

func (*TrackerTree) GetNodeCount

func (t *TrackerTree) GetNodeCount() int

GetNodeCount returns the total number of nodes in the tree

func (*TrackerTree) GetRoots

func (t *TrackerTree) GetRoots() []TrackerNodeInterface

GetRoots returns the root nodes of the tracker tree.

func (*TrackerTree) RegisterInterfaceResolution

func (t *TrackerTree) RegisterInterfaceResolution(interfaceType, structType, pkg, concreteType string)

RegisterInterfaceResolution registers a mapping from an interface type to its concrete implementation in a specific struct context. This is used to resolve embedded interfaces in structs.

func (*TrackerTree) ResolveInterface

func (t *TrackerTree) ResolveInterface(interfaceType, structType, pkg string) string

ResolveInterface resolves an interface type to its concrete implementation in a struct context. Returns the concrete type if found, otherwise returns the original interface type.

func (*TrackerTree) ResolveInterfaceFromMetadata

func (t *TrackerTree) ResolveInterfaceFromMetadata(interfaceType, structType, pkg string) string

ResolveInterfaceFromMetadata resolves an interface using metadata and local cache

func (*TrackerTree) SyncInterfaceResolutionsFromMetadata

func (t *TrackerTree) SyncInterfaceResolutionsFromMetadata()

SyncInterfaceResolutionsFromMetadata copies interface resolutions from metadata

func (*TrackerTree) TraceArgumentOrigin

func (t *TrackerTree) TraceArgumentOrigin(argNode *TrackerNode) *TrackerNode

TraceArgumentOrigin traces an argument back to its original definition

func (*TrackerTree) TraverseTree

func (t *TrackerTree) TraverseTree(visitor func(node TrackerNodeInterface) bool)

TraverseTree traverses the tree with a visitor function

type TrackerTreeInterface

type TrackerTreeInterface interface {
	// GetRoots returns the root nodes of the tracker tree
	GetRoots() []TrackerNodeInterface

	// GetNodeCount returns the total number of nodes in the tree
	GetNodeCount() int

	// FindNodeByKey finds a node by its key
	FindNodeByKey(key string) TrackerNodeInterface

	// GetFunctionContext returns context information for a function
	GetFunctionContext(functionName string) (*metadata.Function, string, string)

	// TraverseTree traverses the tree with a visitor function
	TraverseTree(visitor func(node TrackerNodeInterface) bool)

	// GetMetadata returns the underlying metadata
	GetMetadata() *metadata.Metadata

	// GetLimits returns the tracker limits
	GetLimits() metadata.TrackerLimits
}

TrackerTreeInterface defines the interface for tracker tree operations

type TypeMapping

type TypeMapping struct {
	GoType      string  `yaml:"goType"`
	OpenAPIType *Schema `yaml:"openapiType"`
}

TypeMapping maps Go types to OpenAPI schemas

type TypeResolver

type TypeResolver interface {
	// ResolveType resolves a Go type to its concrete type
	ResolveType(arg metadata.CallArgument, context TrackerNodeInterface) string

	// MapToOpenAPISchema maps a Go type to OpenAPI schema
	MapToOpenAPISchema(goType string) *Schema
}

TypeResolver defines the interface for type resolution operations

type TypeResolverImpl

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

TypeResolverImpl implements TypeResolver

func NewTypeResolver

func NewTypeResolver(meta *metadata.Metadata, cfg *APISpecConfig, schemaMapper SchemaMapper) *TypeResolverImpl

NewTypeResolver creates a new type resolver

func (*TypeResolverImpl) ExtractTypeParameters

func (t *TypeResolverImpl) ExtractTypeParameters(genericType string) map[string]string

ExtractTypeParameters extracts type parameters from a generic type

func (*TypeResolverImpl) MapToOpenAPISchema

func (t *TypeResolverImpl) MapToOpenAPISchema(goType string) *Schema

MapToOpenAPISchema maps a Go type to OpenAPI schema

func (*TypeResolverImpl) ResolveGenericType

func (t *TypeResolverImpl) ResolveGenericType(genericType string, typeParams map[string]string) string

ResolveGenericType resolves a generic type with concrete type parameters

func (*TypeResolverImpl) ResolveType

func (t *TypeResolverImpl) ResolveType(arg metadata.CallArgument, context TrackerNodeInterface) string

ResolveType resolves a Go type to its concrete type, handling generics and type parameters

type ValidationConstraints

type ValidationConstraints struct {
	MinLength *int
	MaxLength *int
	Min       *float64
	Max       *float64
	Format    string
	Pattern   string
	Required  bool
	Dive      bool // When true, constraints apply to array items, not the array itself
	Enum      []interface{}
}

ValidationConstraints represents validation constraints extracted from struct tags

type VariableTracer

type VariableTracer interface {
	// TraceVariable traces a variable back to its origin
	TraceVariable(varName, funcName, pkgName string) (originVar, originPkg string, originType *metadata.CallArgument)

	// FindAssignmentFunction finds the assignment function for a variable
	FindAssignmentFunction(arg *metadata.CallArgument) *metadata.CallArgument
}

VariableTracer defines the interface for variable tracing operations

type XML

type XML struct {
	Name      string `yaml:"name,omitempty" json:"name,omitempty"`
	Namespace string `yaml:"namespace,omitempty" json:"namespace,omitempty"`
	Prefix    string `yaml:"prefix,omitempty" json:"prefix,omitempty"`
	Attribute bool   `yaml:"attribute,omitempty" json:"attribute,omitempty"`
	Wrapped   bool   `yaml:"wrapped,omitempty" json:"wrapped,omitempty"`
}

XML represents XML serialization options

Jump to

Keyboard shortcuts

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