Documentation ¶
Index ¶
- func NewDocumentFromFile(filePath string) (openapi.Document, error)
- func NewSchema(schema *base.Schema, parseConfig *config.ParseConfig) *openapi.Schema
- func NewValidator(doc openapi.Document) openapi.Validator
- type V2Document
- func (d *V2Document) FindOperation(options *openapi.OperationDescription) openapi.Operation
- func (d *V2Document) GetResources() map[string][]string
- func (d *V2Document) GetSecurity() openapi.SecurityComponents
- func (d *V2Document) GetVersion() string
- func (d *V2Document) Provider() config.SchemaProvider
- type V2Operation
- type V3Document
- func (d *V3Document) FindOperation(options *openapi.OperationDescription) openapi.Operation
- func (d *V3Document) GetResources() map[string][]string
- func (d *V3Document) GetSecurity() openapi.SecurityComponents
- func (d *V3Document) GetVersion() string
- func (d *V3Document) Provider() config.SchemaProvider
- type V3Operation
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDocumentFromFile ¶
NewDocumentFromFile creates a new Document from a file path. It uses libopenapi to parse the file and then builds a model. Circular references are handled by logging the error and returning Document without errors.
Types ¶
type V2Document ¶
type V2Document struct { *libopenapi.DocumentModel[v2high.Swagger] ParseConfig *config.ParseConfig }
V2Document is a wrapper around libopenapi.DocumentModel Implements Document interface
func (*V2Document) FindOperation ¶
func (d *V2Document) FindOperation(options *openapi.OperationDescription) openapi.Operation
FindOperation finds an operation by resource and method.
func (*V2Document) GetResources ¶
func (d *V2Document) GetResources() map[string][]string
GetResources returns a map of resource names and their methods.
func (*V2Document) GetSecurity ¶ added in v0.1.29
func (d *V2Document) GetSecurity() openapi.SecurityComponents
func (*V2Document) GetVersion ¶
func (d *V2Document) GetVersion() string
GetVersion returns the version of the document
func (*V2Document) Provider ¶
func (d *V2Document) Provider() config.SchemaProvider
Provider returns the SchemaProvider for this document
type V2Operation ¶
type V2Operation struct { *v2high.Operation ParseConfig *config.ParseConfig // contains filtered or unexported fields }
V2Operation is a wrapper around libopenapi.Operation
func (*V2Operation) GetRequest ¶ added in v0.1.29
func (op *V2Operation) GetRequest(securityComponents openapi.SecurityComponents) *openapi.Request
func (*V2Operation) GetResponse ¶
func (op *V2Operation) GetResponse() *openapi.Response
GetResponse returns the response for this operation
func (*V2Operation) WithParseConfig ¶
func (op *V2Operation) WithParseConfig(parseConfig *config.ParseConfig) openapi.Operation
WithParseConfig sets the ParseConfig for the operation
type V3Document ¶
type V3Document struct { *libopenapi.DocumentModel[v3high.Document] }
V3Document is a wrapper around libopenapi.DocumentModel Implements Document interface
func (*V3Document) FindOperation ¶
func (d *V3Document) FindOperation(options *openapi.OperationDescription) openapi.Operation
FindOperation finds an operation by resource and method.
func (*V3Document) GetResources ¶
func (d *V3Document) GetResources() map[string][]string
GetResources returns a map of resource names and their methods.
func (*V3Document) GetSecurity ¶ added in v0.1.29
func (d *V3Document) GetSecurity() openapi.SecurityComponents
func (*V3Document) GetVersion ¶
func (d *V3Document) GetVersion() string
GetVersion returns the version of the document
func (*V3Document) Provider ¶
func (d *V3Document) Provider() config.SchemaProvider
Provider returns the SchemaProvider for this document
type V3Operation ¶
V3Operation is a wrapper around libopenapi.Operation
func (*V3Operation) GetRequest ¶ added in v0.1.29
func (op *V3Operation) GetRequest(securityComponents openapi.SecurityComponents) *openapi.Request
func (*V3Operation) GetResponse ¶
func (op *V3Operation) GetResponse() *openapi.Response
GetResponse returns the response for the operation. If no response is defined, a default response is returned. Responses are prioritized by status code, with 200 being the highest priority.
func (*V3Operation) WithParseConfig ¶
func (op *V3Operation) WithParseConfig(parseConfig *config.ParseConfig) openapi.Operation
WithParseConfig sets the ParseConfig for the operation.
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
func (*Validator) ValidateRequest ¶
func (v *Validator) ValidateRequest(req *openapi.GeneratedRequest) []error
ValidateRequest validates a GeneratedRequest against the OpenAPI document. Implements Validator interface.
func (*Validator) ValidateResponse ¶
func (v *Validator) ValidateResponse(res *openapi.GeneratedResponse) []error
ValidateResponse validates a response against the OpenAPI document. Implements Validator interface.