oas3

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandOperation

func ExpandOperation(operation *openapi3.Operation, oas3 *openapi3.Swagger) error

ExpandOperation 展开所有 operation 中的请求体和响应体

func ExpandPaths

func ExpandPaths(oas3 *openapi3.Swagger) error

ExpandPaths 展开所有路径中的所有请求体和响应体

func ExpandRequestBody

func ExpandRequestBody(ref *openapi3.RequestBodyRef, oas3 *openapi3.Swagger) error

ExpandRequestBody 如果 request body 中引用了 Components, 则将 request body 的结构展开, 直到不再包含任何引用的结构

func ExpandResponses

func ExpandResponses(responses openapi3.Responses, oas3 *openapi3.Swagger) error

ExpandResponses 将所有的 response body 都展开

func ExpandSchemaRef

func ExpandSchemaRef(ref *openapi3.SchemaRef, oas3 *openapi3.Swagger) error

ExpandSchemaRef 展开 SchemaRef

func GenExampleFromExpandedSchema added in v1.3.0

func GenExampleFromExpandedSchema(mediaType httputil.ContentType, schema *openapi3.Schema)

为 *openapi3.Schema 生成 Example, 就地修改 schema.Example 字段 生成前 Schema 应当是展开的, 不能包含引用

func LoadFromData

func LoadFromData(data []byte) (*openapi3.Swagger, error)

func MarshalJson

func MarshalJson(v3 *openapi3.Swagger) ([]byte, error)

func MarshalJsonIndent

func MarshalJsonIndent(v3 *openapi3.Swagger, prefix, indent string) ([]byte, error)

func MarshalYaml

func MarshalYaml(v3 *openapi3.Swagger) ([]byte, error)

func ValidateComponents

func ValidateComponents(ctx context.Context, components openapi3.Components) error

func ValidateContact

func ValidateContact(_ context.Context, _ *openapi3.Contact) error

func ValidateContent

func ValidateContent(ctx context.Context, content openapi3.Content) error

func ValidateHeader

func ValidateHeader(ctx context.Context, header *openapi3.Header) error

func ValidateHeaderRef

func ValidateHeaderRef(ctx context.Context, ref *openapi3.HeaderRef) error

func ValidateIdentifier

func ValidateIdentifier(_ string) error

func ValidateInfo

func ValidateInfo(ctx context.Context, info *openapi3.Info) error

func ValidateLicense

func ValidateLicense(_ context.Context, license *openapi3.License) error

func ValidateMediaType

func ValidateMediaType(ctx context.Context, mediaType *openapi3.MediaType) error

func ValidateOAS3

func ValidateOAS3(ctx context.Context, oas3 openapi3.Swagger) error

func ValidateOAuthFlow

func ValidateOAuthFlow(_ context.Context, flow *openapi3.OAuthFlow, typ oAuthFlowType) error

func ValidateOAuthFlows

func ValidateOAuthFlows(ctx context.Context, flows *openapi3.OAuthFlows) error

func ValidateOperation

func ValidateOperation(ctx context.Context, operation *openapi3.Operation) error

func ValidateParameter

func ValidateParameter(ctx context.Context, parameter *openapi3.Parameter) error

func ValidateParameterRef

func ValidateParameterRef(ctx context.Context, ref *openapi3.ParameterRef) error

func ValidateParameters

func ValidateParameters(ctx context.Context, parameters openapi3.Parameters) error

func ValidatePathItem

func ValidatePathItem(ctx context.Context, pathItem *openapi3.PathItem) error

func ValidatePaths

func ValidatePaths(ctx context.Context, paths openapi3.Paths) error

func ValidateRequestBody

func ValidateRequestBody(ctx context.Context, requestBody *openapi3.RequestBody) error

func ValidateRequestBodyRef

func ValidateRequestBodyRef(ctx context.Context, ref *openapi3.RequestBodyRef) error

func ValidateResponse

func ValidateResponse(ctx context.Context, response *openapi3.Response) error

func ValidateResponseRef

func ValidateResponseRef(ctx context.Context, ref *openapi3.ResponseRef) error

func ValidateSchema

func ValidateSchema(ctx context.Context, schema *openapi3.Schema, stack []*openapi3.Schema) error

func ValidateSchemaRef

func ValidateSchemaRef(ctx context.Context, ref *openapi3.SchemaRef, stack []*openapi3.Schema) error

func ValidateSecurity

func ValidateSecurity(ctx context.Context, securities openapi3.SecurityRequirements) error

func ValidateSecurityRequirement

func ValidateSecurityRequirement(_ context.Context, _ openapi3.SecurityRequirement) error

func ValidateSecurityScheme

func ValidateSecurityScheme(ctx context.Context, ss *openapi3.SecurityScheme) error

func ValidateSecuritySchemeRef

func ValidateSecuritySchemeRef(ctx context.Context, ref *openapi3.SecuritySchemeRef) error

func ValidateServer

func ValidateServer(ctx context.Context, server *openapi3.Server) error

func ValidateServerVariable

func ValidateServerVariable(ctx context.Context, serverVariable *openapi3.ServerVariable) error

func ValidateServers

func ValidateServers(ctx context.Context, servers openapi3.Servers) error

Types

type ValidateError

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

func (*ValidateError) Error

func (e *ValidateError) Error() string

func (*ValidateError) Wrap

func (e *ValidateError) Wrap(err error) error

Jump to

Keyboard shortcuts

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