openapidoc

package module
v1.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 12 Imported by: 0

README

Golang openapidoc

This is library to make your life easier by generating openapi3 Spec file using pure Golang struct, NO LONG COMMENTS required!

Usage

$ go get -u github.com/yusufsyaifudin/openapidoc

See _example folder to see the usage.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithGenerator

func WithGenerator(gen *openapi3gen.Generator) func(*Config)

func WithServerInfo

func WithServerInfo(serverInfo *openapi3.Info) func(*Config)

func WithServers

func WithServers(servers openapi3.Servers) func(*Config)

Types

type Config

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

type Registry

type Registry struct {
	Config *Config
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry(configs ...func(*Config)) *Registry

func (*Registry) Add

func (r *Registry) Add(method string, path string, req *request.Request, resp map[string]*response.Response)

Add method contains http method: GET, POST, PUT, PATCH, HEAD, DELETE path contains URL path such as /api/v1/xxx req contains request body, header, params, etc.. resp contains map of http status as key and response body as value, for example: 200:&response.Response{}

Multiple path with different method can be added.

func (*Registry) Generate

func (r *Registry) Generate() (*openapi3.T, error)

Directories

Path Synopsis
_example

Jump to

Keyboard shortcuts

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