kin

package
v0.1.29 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDocumentFromFile

func NewDocumentFromFile(filePath string) (openapi.Document, error)

NewDocumentFromFile creates a new Document from a file path

func NewSchemaFromKin

func NewSchemaFromKin(schema *openapi3.Schema, parseConfig *config.ParseConfig) *openapi.Schema

NewSchemaFromKin creates a new Scheme from a Kin schema

func NewValidator

func NewValidator(_ openapi.Document) openapi.Validator

NewValidator creates a new Validator from kin-openapi document.

Types

type Document

type Document struct {
	*openapi3.T
}

Document is a wrapper around openapi3.T Implements Document interface

func (*Document) FindOperation

func (d *Document) FindOperation(options *openapi.OperationDescription) openapi.Operation

FindOperation finds an operation by resource and method.

func (*Document) GetResources

func (d *Document) GetResources() map[string][]string

GetResources returns a map of resource names and their methods.

func (*Document) GetSecurity added in v0.1.29

func (d *Document) GetSecurity() openapi.SecurityComponents

func (*Document) GetVersion

func (d *Document) GetVersion() string

GetVersion returns the version of the document

func (*Document) Provider

func (d *Document) Provider() config.SchemaProvider

Provider returns the SchemaProvider for this document

type KinOperation

type KinOperation struct {
	*openapi3.Operation
	// contains filtered or unexported fields
}

KinOperation is a wrapper around openapi3.Operation

func (*KinOperation) GetRequest added in v0.1.29

func (op *KinOperation) GetRequest(securityComponents openapi.SecurityComponents) *openapi.Request

func (*KinOperation) GetResponse

func (op *KinOperation) GetResponse() *openapi.Response

GetResponse returns the operation response

func (*KinOperation) ID

func (op *KinOperation) ID() string

ID returns the operation ID

func (*KinOperation) WithParseConfig

func (op *KinOperation) WithParseConfig(config *config.ParseConfig) openapi.Operation

WithParseConfig sets the parse config for this operation

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

func (*Validator) ValidateRequest

func (v *Validator) ValidateRequest(req *openapi.GeneratedRequest) []error

ValidateRequest validates GeneratedRequest against a schema.

func (*Validator) ValidateResponse

func (v *Validator) ValidateResponse(res *openapi.GeneratedResponse) []error

ValidateResponse validates a response against an Operation. GeneratedResponse must contain non-empty headers or it'll fail validation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL