openapi

package
v1.3.3-beta7 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

README

REF: github.com/getkin/go-openapi

DEPS

  1. easyjson
  2. go-openapi/swag

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Exports = map[string]any{
	"Generate":    Generate,
	"https":       WithHttps,
	"flowHandler": WithFlowHandler,
	"domain":      WithDomain,
}

Functions

func Generate

func Generate(doc string, opt ...Option) error

Generate means generate yakit.HTTPFlow via openapi2/3 scheme use WithFlowHandler to recv and handle it Example:

openapi.Generate(fileName, openapi.flowHandler(flow => {
	dump(flow.Url)
}))

func OpenAPIToHTTPFlow

func OpenAPIToHTTPFlow(t string)

func OpenAPITypeToMockDataLiteral

func OpenAPITypeToMockDataLiteral(t string, defaults ...any) any

func ValueViaField

func ValueViaField(field string, t string, defaults ...any) any

Types

type OpenAPIConfig

type OpenAPIConfig struct {
	Domain      string
	FlowHandler func(flow *yakit.HTTPFlow)
	IsHttps     bool
}

func NewDefaultOpenAPIConfig

func NewDefaultOpenAPIConfig() *OpenAPIConfig

type Option

type Option func(config *OpenAPIConfig)

func WithDomain

func WithDomain(domain string) Option

WithDomain means use this domain

func WithFlowHandler

func WithFlowHandler(handler func(flow *yakit.HTTPFlow)) Option

WithFlowHandler means use this handler

func WithHttps

func WithHttps(b bool) Option

WithHttps means use https

Directories

Path Synopsis
Package openapi2 parses and writes OpenAPIv2 specification documents.
Package openapi2 parses and writes OpenAPIv2 specification documents.
Package openapi3 parses and writes OpenAPI 3 specification documents.
Package openapi3 parses and writes OpenAPI 3 specification documents.

Jump to

Keyboard shortcuts

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