openapi

package
v0.0.0-...-018b13d Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultDescription

func DefaultDescription[T any](handler string, middlewares []T) string

DefaultDescription returns a default .md description for a controller

func FuncName

func FuncName(f interface{}) string

FuncName returns the name of a function and the name with package path 返回 函数名 和 包名

func NewOpenApiSpec

func NewOpenApiSpec() openapi3.T

Types

type Descriptioner

type Descriptioner interface {
	Description() string
}

type OpenAPI

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

OpenAPI Holds the OpenAPI OpenAPIDescription (OAD) and OpenAPI capabilities.

func NewOpenAPI

func NewOpenAPI() *OpenAPI

func (*OpenAPI) Description

func (openAPI *OpenAPI) Description() *openapi3.T

func (*OpenAPI) Generator

func (openAPI *OpenAPI) Generator() *openapi3gen.Generator

type Path

type Path[Res, Req any] struct {
	Operation            *openapi3.Operation
	FullName             string
	Path                 string
	AcceptedContentTypes []string
	DefaultStatusCode    int
	Method               string

	Middlewares []gin.HandlerFunc
	// contains filtered or unexported fields
}

func (*Path[Res, Req]) GenerateDefaultDescription

func (p *Path[Res, Req]) GenerateDefaultDescription()

func (*Path[Res, Req]) GenerateDefaultOperationID

func (p *Path[Res, Req]) GenerateDefaultOperationID()

func (*Path[Res, Req]) NameFromNamespace

func (p *Path[Res, Req]) NameFromNamespace(human any) string

func (*Path[Res, Req]) RegisterOpenAPIOperation

func (p *Path[Res, Req]) RegisterOpenAPIOperation(openapi *OpenAPI) error

type Response

type Response struct {
	// content-type of the response i.e application/json
	ContentTypes []string
	// user provided type
	Type any
}

when setting custom response types on routes

type SchemaTag

type SchemaTag struct {
	openapi3.SchemaRef
	Name string
}

SchemaTag is a struct that holds the name of the struct and the associated openapi3.SchemaRef

func SchemaTagFromType

func SchemaTagFromType(openapi *OpenAPI, v any) SchemaTag

Jump to

Keyboard shortcuts

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