oas

package
v0.0.0-...-692fcab Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Code           string      `json:"code,omitempty" yaml:"code,omitempty"`
	Msg            string      `json:"message,omitempty" yaml:"message,omitempty"`
	AdditionalData *JSONObject `json:"data,omitempty" yaml:"data,omitempty"`
}

Error is data object for returning errors

func Err

func Err(code string) *Error

Err is the constructor for Error

func (*Error) Data

func (e *Error) Data(data *JSONObject) *Error

Data sets the data property for Error

func (*Error) Message

func (e *Error) Message(msg string) *Error

Message sets the message for Error

type JSONObject

type JSONObject map[string]interface{}

JSONObject represents a map[string]interface{} shorthand

type OAS

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

OAS is the main structure for OpenAPI generation

func Of

func Of(path string, tags ...string) *OAS

Of returns an instance of OAS

func (*OAS) AddDescription

func (o *OAS) AddDescription(description string) *OAS

AddDescription adds a description for the route

func (*OAS) AddHeaderParam

func (o *OAS) AddHeaderParam(name string) *OAS

AddHeaderParam adds query params to spec

func (*OAS) AddPrefix

func (o *OAS) AddPrefix(prefix string) *OAS

AddPrefix adds an url prefix

func (*OAS) AddQueryParam

func (o *OAS) AddQueryParam(name string) *OAS

AddQueryParam adds query params to spec

func (*OAS) AddResponse

func (o *OAS) AddResponse(body interface{}, code int) *OAS

AddResponse adds an additional response to spec

func (*OAS) AddSummary

func (o *OAS) AddSummary(summary string) *OAS

AddSummary adds a summary for the route

func (*OAS) AddTags

func (o *OAS) AddTags(tags ...string) *OAS

AddTags appends tags

func (*OAS) Build

func (o *OAS) Build(ref *openapi3.Reflector) *OAS

Build constructs the OpenAPI spec for a single request

func (*OAS) Delete

func (o *OAS) Delete(body interface{}, code ...int) *OAS

Delete handles the DELETE request spec

func (*OAS) Get

func (o *OAS) Get(body interface{}, code ...int) *OAS

Get handles the GET request spec

func (*OAS) Patch

func (o *OAS) Patch(body interface{}, data interface{}, code ...int) *OAS

Patch handles the PATCH request spec

func (*OAS) Post

func (o *OAS) Post(body interface{}, data interface{}, code ...int) *OAS

Post handles the POST request spec

func (*OAS) Put

func (o *OAS) Put(body interface{}, data interface{}, code ...int) *OAS

Put handles the PUT request spec

func (*OAS) ReplaceTags

func (o *OAS) ReplaceTags(tags ...string) *OAS

ReplaceTags replaces oas tags

Jump to

Keyboard shortcuts

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