Documentation
¶
Index ¶
- Constants
- func GenerateSwaggerUIHTML(specURL, title string) string
- type AnnotationParser
- func (p *AnnotationParser) BuildSwagger() error
- func (p *AnnotationParser) ClearCache()
- func (p *AnnotationParser) GetErrorSummary() map[string]int
- func (p *AnnotationParser) GetMemoryStats() map[string]interface{}
- func (p *AnnotationParser) GetStats() *ParseStats
- func (p *AnnotationParser) OptimizeMemory()
- func (p *AnnotationParser) ParseFile(filename string) error
- func (p *AnnotationParser) ScanDirectory(dir string) error
- type Field
- type FileWatcher
- type FileWatcherConfig
- type GenConfig
- type Generator
- type HeaderInfo
- type InfoConfig
- type ModelInfo
- type Package
- type ParamInfo
- type Parameter
- type ParseError
- type ParseStats
- type Parser
- type PlugSwagger
- func (p *PlugSwagger) AddDefinition(name string, schema spec.Schema)
- func (p *PlugSwagger) AddPath(path string, item spec.PathItem)
- func (p *PlugSwagger) CheckHealth() error
- func (p *PlugSwagger) CleanupTasks() error
- func (p *PlugSwagger) GetSwagger() *spec.Swagger
- func (p *PlugSwagger) Health() error
- func (p *PlugSwagger) InitializeResources(rt plugins.Runtime) error
- func (p *PlugSwagger) SetDefaultValues()
- func (p *PlugSwagger) StartupTasks() error
- func (p *PlugSwagger) UpdateSwagger(swagger *spec.Swagger)
- type PropertyInfo
- type Response
- type ResponseInfo
- type Route
- type RouteInfo
- type SchemaInfo
- type SecurityConfig
- type StringBuilderPool
- type Struct
- type SwaggerConfig
- type SwaggerUIServer
- type UIConfig
Constants ¶
const ( EnvDevelopment = "development" EnvTesting = "testing" EnvStaging = "staging" EnvProduction = "production" )
Environment types
Variables ¶
This section is empty.
Functions ¶
func GenerateSwaggerUIHTML ¶
GenerateSwaggerUIHTML generates Swagger UI HTML (kept for backward compatibility) Deprecated: Use ui.Handler instead
Types ¶
type AnnotationParser ¶
type AnnotationParser struct {
// contains filtered or unexported fields
}
AnnotationParser annotation parser with memory management
func NewAnnotationParser ¶
func NewAnnotationParser(swagger *spec.Swagger, allowedDirs []string) *AnnotationParser
NewAnnotationParser creates an annotation parser
func (*AnnotationParser) BuildSwagger ¶
func (p *AnnotationParser) BuildSwagger() error
BuildSwagger builds Swagger specification
func (*AnnotationParser) ClearCache ¶
func (p *AnnotationParser) ClearCache()
ClearCache clears all caches and resets statistics
func (*AnnotationParser) GetErrorSummary ¶
func (p *AnnotationParser) GetErrorSummary() map[string]int
GetErrorSummary returns a summary of parsing errors
func (*AnnotationParser) GetMemoryStats ¶
func (p *AnnotationParser) GetMemoryStats() map[string]interface{}
GetMemoryStats returns memory usage statistics
func (*AnnotationParser) GetStats ¶
func (p *AnnotationParser) GetStats() *ParseStats
GetStats returns parsing statistics
func (*AnnotationParser) OptimizeMemory ¶
func (p *AnnotationParser) OptimizeMemory()
OptimizeMemory optimizes memory usage
func (*AnnotationParser) ParseFile ¶
func (p *AnnotationParser) ParseFile(filename string) error
ParseFile parses a file with comprehensive error handling
func (*AnnotationParser) ScanDirectory ¶
func (p *AnnotationParser) ScanDirectory(dir string) error
ScanDirectory scans directory
type FileWatcher ¶
type FileWatcher struct {
// contains filtered or unexported fields
}
FileWatcher enhanced file monitoring
func (*FileWatcher) GetStats ¶
func (w *FileWatcher) GetStats() map[string]interface{}
GetStats returns file watcher statistics
func (*FileWatcher) IsHealthy ¶
func (w *FileWatcher) IsHealthy() bool
IsHealthy returns the health status of the file watcher
type FileWatcherConfig ¶
type FileWatcherConfig struct {
Enabled bool `json:"enabled" yaml:"enabled"`
Interval time.Duration `json:"interval" yaml:"interval"`
DebounceDelay time.Duration `json:"debounce_delay" yaml:"debounce_delay"`
MaxRetries int `json:"max_retries" yaml:"max_retries"`
RetryDelay time.Duration `json:"retry_delay" yaml:"retry_delay"`
BatchSize int `json:"batch_size" yaml:"batch_size"`
HealthCheck bool `json:"health_check" yaml:"health_check"`
}
FileWatcherConfig configuration for file watching
type GenConfig ¶
type GenConfig struct {
Enabled bool `json:"enabled" yaml:"enabled"`
ScanDirs []string `json:"scan_dirs" yaml:"scan_dirs"`
OutputPath string `json:"output_path" yaml:"output_path"`
WatchFiles bool `json:"watch_files" yaml:"watch_files"`
FileWatcher FileWatcherConfig `json:"file_watcher" yaml:"file_watcher"`
}
GenConfig generator configuration
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator Swagger documentation generator
type HeaderInfo ¶
HeaderInfo response header information
type InfoConfig ¶
type InfoConfig struct {
Title string `json:"title" yaml:"title"`
Description string `json:"description" yaml:"description"`
Version string `json:"version" yaml:"version"`
TermsOfService string `json:"termsOfService" yaml:"termsOfService"`
Contact struct {
Name string `json:"name" yaml:"name"`
Email string `json:"email" yaml:"email"`
URL string `json:"url" yaml:"url"`
} `json:"contact" yaml:"contact"`
License struct {
Name string `json:"name" yaml:"name"`
URL string `json:"url" yaml:"url"`
} `json:"license" yaml:"license"`
}
InfoConfig API basic information
type ModelInfo ¶
type ModelInfo struct {
Name string
Description string
Properties map[string]PropertyInfo
Required []string
}
ModelInfo model information
type ParamInfo ¶
type ParamInfo struct {
Name string
In string // path, query, header, body, formData
Type string
Format string
Required bool
Description string
Default interface{}
Example interface{}
}
ParamInfo parameter information
type Parameter ¶
type Parameter struct {
Name string
In string // path, query, header, body
Type string
Required bool
Description string
Example interface{}
}
Parameter parameter information
type ParseError ¶
ParseError detailed error information
type ParseStats ¶
type ParseStats struct {
TotalFiles int
SuccessFiles int
FailedFiles int
TotalLines int
ParsedRoutes int
ParsedModels int
Errors []ParseError
StartTime time.Time
EndTime time.Time
}
ParseStats statistics for parsing operations
type PlugSwagger ¶
type PlugSwagger struct {
*plugins.BasePlugin
// contains filtered or unexported fields
}
PlugSwagger Swagger plugin
func NewSwaggerPlugin ¶
func NewSwaggerPlugin() *PlugSwagger
NewSwaggerPlugin creates a Swagger plugin
func (*PlugSwagger) AddDefinition ¶
func (p *PlugSwagger) AddDefinition(name string, schema spec.Schema)
AddDefinition adds definition
func (*PlugSwagger) AddPath ¶
func (p *PlugSwagger) AddPath(path string, item spec.PathItem)
AddPath adds path
func (*PlugSwagger) CheckHealth ¶
func (p *PlugSwagger) CheckHealth() error
CheckHealth health check
func (*PlugSwagger) CleanupTasks ¶
func (p *PlugSwagger) CleanupTasks() error
CleanupTasks cleanup tasks
func (*PlugSwagger) GetSwagger ¶
func (p *PlugSwagger) GetSwagger() *spec.Swagger
GetSwagger gets Swagger specification
func (*PlugSwagger) InitializeResources ¶
func (p *PlugSwagger) InitializeResources(rt plugins.Runtime) error
InitializeResources initializes resources
func (*PlugSwagger) SetDefaultValues ¶
func (p *PlugSwagger) SetDefaultValues()
SetDefaultValues sets default values for configuration
func (*PlugSwagger) StartupTasks ¶
func (p *PlugSwagger) StartupTasks() error
StartupTasks startup tasks
func (*PlugSwagger) UpdateSwagger ¶
func (p *PlugSwagger) UpdateSwagger(swagger *spec.Swagger)
UpdateSwagger updates Swagger specification
type PropertyInfo ¶
type PropertyInfo struct {
Type string
Format string
Description string
Example interface{}
Enum []interface{}
Minimum *float64
Maximum *float64
MinLength *int64
MaxLength *int64
Pattern string
}
PropertyInfo property information
type ResponseInfo ¶
type ResponseInfo struct {
Description string
Schema *SchemaInfo
Headers map[string]HeaderInfo
}
ResponseInfo response information
type Route ¶
type Route struct {
Method string
Path string
Handler string
Summary string
Description string
Tags []string
Parameters []Parameter
Responses map[string]Response
}
Route route information
type RouteInfo ¶
type RouteInfo struct {
Method string
Path string
Summary string
Description string
Tags []string
Params []ParamInfo
Responses map[int]ResponseInfo
Security []map[string][]string
}
RouteInfo route information
type SchemaInfo ¶
type SchemaInfo struct {
Type string
Format string
Ref string
Properties map[string]*SchemaInfo
Items *SchemaInfo
Required []string
}
SchemaInfo schema information
type SecurityConfig ¶
type SecurityConfig struct {
Environment string `json:"environment" yaml:"environment"`
AllowedEnvs []string `json:"allowed_environments" yaml:"allowed_environments"`
DisableInProd bool `json:"disable_in_production" yaml:"disable_in_production"`
TrustedOrigins []string `json:"trusted_origins" yaml:"trusted_origins"`
RequireAuth bool `json:"require_auth" yaml:"require_auth"`
}
SecurityConfig security configuration
type StringBuilderPool ¶
type StringBuilderPool struct {
// contains filtered or unexported fields
}
StringBuilderPool string builder object pool
func NewStringBuilderPool ¶
func NewStringBuilderPool(size int) *StringBuilderPool
NewStringBuilderPool creates a new string builder pool
func (*StringBuilderPool) Get ¶
func (p *StringBuilderPool) Get() *strings.Builder
Get gets a string builder from pool
func (*StringBuilderPool) Put ¶
func (p *StringBuilderPool) Put(sb *strings.Builder)
Put returns a string builder to pool
type SwaggerConfig ¶
type SwaggerConfig struct {
Enabled bool `json:"enabled" yaml:"enabled"`
Info InfoConfig `json:"info" yaml:"info"`
UI UIConfig `json:"ui" yaml:"ui"`
Gen GenConfig `json:"generator" yaml:"generator"`
Security SecurityConfig `json:"security" yaml:"security"`
}
SwaggerConfig plugin configuration
type SwaggerUIServer ¶
type SwaggerUIServer struct {
// contains filtered or unexported fields
}
SwaggerUIServer Swagger UI server
func NewSwaggerUIServer ¶
func NewSwaggerUIServer(port int, path, specURL, title string) *SwaggerUIServer
NewSwaggerUIServer creates a Swagger UI server
type UIConfig ¶
type UIConfig struct {
Path string `json:"path" yaml:"path"`
Enabled bool `json:"enabled" yaml:"enabled"`
DeepLinking bool `json:"deepLinking" yaml:"deepLinking"`
DisplayRequestDuration bool `json:"displayRequestDuration" yaml:"displayRequestDuration"`
DocExpansion string `json:"docExpansion" yaml:"docExpansion"`
DefaultModelsExpandDepth int `json:"defaultModelsExpandDepth" yaml:"defaultModelsExpandDepth"`
Port int `json:"port" yaml:"port"`
}
UIConfig UI configuration