Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalSpec ¶ added in v1.2.0
func MarshalSpec(spec *OpenAPISpec, format Format) ([]byte, error)
MarshalSpec serializes the generated OpenAPI spec in the requested format. The spec's JSON tags are the source of truth for both formats: YAML is produced by round-tripping the spec through JSON so the emitted document has exactly the shape of the JSON output.
Types ¶
type Format ¶ added in v1.2.0
type Format string
Format identifies a serialization format for generated specs.
type OpenAPIConfig ¶
type OpenAPIConfig struct {
Title string
Description string
Version string
Servers []OpenAPIServer
TagMappings map[string]string // Maps path prefixes to custom tags
UsePathGroups bool // Whether to group APIs by path segments
VersionPrefixes map[string]bool // Custom version prefixes to detect
}
OpenAPIConfig holds configuration for the generator
type OpenAPIGenerator ¶
type OpenAPIGenerator struct {
// contains filtered or unexported fields
}
OpenAPIGenerator generates OpenAPI specs from API transactions
func NewOpenAPIGenerator ¶
func NewOpenAPIGenerator(config OpenAPIConfig) *OpenAPIGenerator
NewOpenAPIGenerator creates a new OpenAPI generator
func (*OpenAPIGenerator) AddTransaction ¶
func (g *OpenAPIGenerator) AddTransaction(tx proxy.APITransaction)
AddTransaction adds an API transaction to be analyzed
func (*OpenAPIGenerator) GenerateSpec ¶
func (g *OpenAPIGenerator) GenerateSpec() (*OpenAPISpec, error)
GenerateSpec generates an OpenAPI spec from the collected transactions
func (*OpenAPIGenerator) LoadTransactionsFromDirectory ¶
func (g *OpenAPIGenerator) LoadTransactionsFromDirectory(dirPath string) error
LoadTransactionsFromDirectory loads API transactions from all JSON files in a directory
func (*OpenAPIGenerator) LoadTransactionsFromFile ¶
func (g *OpenAPIGenerator) LoadTransactionsFromFile(filename string) error
LoadTransactionsFromFile loads API transactions from a file
type OpenAPIServer ¶
OpenAPIServer represents an API server in the OpenAPI spec
type OpenAPISpec ¶
OpenAPISpec is an alias for openapi3.T to make it clearer