Documentation
¶
Overview ¶
Package parser provides OpenAPI specification parsing functionality.
Index ¶
- type Parser
- func (p *Parser) GetBasePath() string
- func (p *Parser) GetInfo() map[string]string
- func (p *Parser) GetModels() ([]*codegen.CodegenModel, error)
- func (p *Parser) GetOperations() (map[string][]*codegen.CodegenOperation, error)
- func (p *Parser) GetSecuritySchemes() ([]*codegen.CodegenSecurity, error)
- func (p *Parser) LoadFromData(data []byte) error
- func (p *Parser) LoadFromFile(path string) error
- func (p *Parser) LoadFromURL(urlStr string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parser ¶
type Parser struct {
// The loaded OpenAPI document
Doc *openapi3.T
// Generator for type conversions
TypeMapping map[string]string
GetTypeFunc func(schemaType, format string) string
ToModelNameFunc func(name string) string
ToVarNameFunc func(name string) string
// Validation settings
SkipValidation bool
// Collected validation errors and warnings
ValidationErrors []string
ValidationWarnings []string
}
Parser parses OpenAPI specifications and converts them to codegen models.
func (*Parser) GetBasePath ¶
GetBasePath returns the base path from servers.
func (*Parser) GetModels ¶
func (p *Parser) GetModels() ([]*codegen.CodegenModel, error)
GetModels extracts all models from the OpenAPI spec.
func (*Parser) GetOperations ¶
func (p *Parser) GetOperations() (map[string][]*codegen.CodegenOperation, error)
GetOperations extracts all operations grouped by tag.
func (*Parser) GetSecuritySchemes ¶
func (p *Parser) GetSecuritySchemes() ([]*codegen.CodegenSecurity, error)
GetSecuritySchemes extracts security schemes.
func (*Parser) LoadFromData ¶
LoadFromData loads an OpenAPI spec from raw data.
func (*Parser) LoadFromFile ¶
LoadFromFile loads an OpenAPI spec from a file.
func (*Parser) LoadFromURL ¶
LoadFromURL loads an OpenAPI spec from a URL.
Click to show internal directories.
Click to hide internal directories.