Documentation
¶
Overview ¶
Package engine provides the core OpenAPI generation engine used by both the CLI and the generator package.
Index ¶
- Constants
- type Engine
- func (e *Engine) GenerateMetadataOnly() (*metadata.Metadata, error)
- func (e *Engine) GenerateMetadataOnlyWithLogger(logger *VerboseLogger) (*metadata.Metadata, error)
- func (e *Engine) GenerateOpenAPI() (*spec.OpenAPISpec, error)
- func (e *Engine) GetConfig() *EngineConfig
- func (e *Engine) GetMetadata() *metadata.Metadata
- func (e *Engine) ModuleRoot() string
- type EngineConfig
- type VerboseLogger
Constants ¶
const ( // Default values for OpenAPI generation DefaultOutputFile = "openapi.json" DefaultInputDir = "." DefaultTitle = "Generated API" DefaultAPIVersion = "1.0.0" DefaultContactName = "Ehab" DefaultContactURL = "https://ehabterra.github.io/" DefaultContactEmail = "[email protected]" DefaultOpenAPIVersion = "3.1.1" DefaultMaxNodesPerTree = 50000 DefaultMaxChildrenPerNode = 500 DefaultMaxArgsPerFunction = 100 DefaultMaxNestedArgsDepth = 100 DefaultMaxRecursionDepth = 10 DefaultMetadataFile = "metadata.yaml" CopyrightNotice = "apispec - Copyright 2025 Ehab Terra" LicenseNotice = "Licensed under the Apache License 2.0. See LICENSE and NOTICE." FullLicenseNotice = "\n\nCopyright 2025 Ehab Terra. Licensed under the Apache License 2.0. See LICENSE and NOTICE." )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine represents the OpenAPI generation engine
func NewEngine ¶
func NewEngine(config *EngineConfig) *Engine
NewEngine creates a new Engine with the given configuration
func (*Engine) GenerateMetadataOnly ¶ added in v0.3.0
GenerateOpenAPI generates an OpenAPI specification from the configured input directory GenerateMetadataOnly generates only metadata and call graph without OpenAPI spec This is useful for diagram servers and other tools that only need the call graph
func (*Engine) GenerateMetadataOnlyWithLogger ¶ added in v0.3.0
func (e *Engine) GenerateMetadataOnlyWithLogger(logger *VerboseLogger) (*metadata.Metadata, error)
GenerateMetadataOnlyWithLogger generates only metadata and call graph without OpenAPI spec with a custom logger
func (*Engine) GenerateOpenAPI ¶
func (e *Engine) GenerateOpenAPI() (*spec.OpenAPISpec, error)
func (*Engine) GetConfig ¶ added in v0.3.0
func (e *Engine) GetConfig() *EngineConfig
GetConfig returns the current engine configuration
func (*Engine) GetMetadata ¶ added in v0.3.0
GetMetadata returns the current metadata
func (*Engine) ModuleRoot ¶
type EngineConfig ¶
type EngineConfig struct {
InputDir string
OutputFile string
Title string
APIVersion string
Description string
TermsOfService string
ContactName string
ContactURL string
ContactEmail string
LicenseName string
LicenseURL string
OpenAPIVersion string
ConfigFile string
APISpecConfig *spec.APISpecConfig // Direct config object (takes precedence over ConfigFile)
OutputConfig string
WriteMetadata bool
SplitMetadata bool
DiagramPath string
PaginatedDiagram bool
DiagramPageSize int
MaxNodesPerTree int
MaxChildrenPerNode int
MaxArgsPerFunction int
MaxNestedArgsDepth int
MaxRecursionDepth int
// Include/exclude filters
IncludeFiles []string
IncludePackages []string
IncludeFunctions []string
IncludeTypes []string
ExcludeFiles []string
ExcludePackages []string
ExcludeFunctions []string
ExcludeTypes []string
SkipCGOPackages bool
AnalyzeFrameworkDependencies bool
AutoIncludeFrameworkPackages bool
// SkipHTTPFramework excludes net/http from framework dependency analysis
SkipHTTPFramework bool
// Auto-exclude common test files and folders (e.g., *_test.go, tests/)
AutoExcludeTests bool
// Auto-exclude common mock files and folders (e.g., *_mock.go, mocks/)
AutoExcludeMocks bool
// Verbose output control
Verbose bool
// contains filtered or unexported fields
}
EngineConfig holds configuration for the OpenAPI generation engine
func DefaultEngineConfig ¶
func DefaultEngineConfig() *EngineConfig
DefaultEngineConfig returns a new EngineConfig with default values
type VerboseLogger ¶ added in v0.3.0
type VerboseLogger struct {
// contains filtered or unexported fields
}
VerboseLogger provides conditional logging based on verbose setting
func NewVerboseLogger ¶ added in v0.3.0
func NewVerboseLogger(verbose bool) *VerboseLogger
NewVerboseLogger creates a new verbose logger
func (*VerboseLogger) Print ¶ added in v0.3.0
func (vl *VerboseLogger) Print(args ...interface{})
Print prints output only if verbose is enabled
func (*VerboseLogger) Printf ¶ added in v0.3.0
func (vl *VerboseLogger) Printf(format string, args ...interface{})
Printf prints formatted output only if verbose is enabled
func (*VerboseLogger) Println ¶ added in v0.3.0
func (vl *VerboseLogger) Println(args ...interface{})
Println prints output only if verbose is enabled