openapi

package
v0.0.0-...-b52a20e Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SwaggerUIHTML embed.FS

Functions

func SwaggerUIHandler

func SwaggerUIHandler() ([]byte, error)

SwaggerUIHandler returns the Swagger UI HTML content

Types

type Config

type Config struct {
	Title          string
	Description    string
	Version        string
	OpenAPIVersion string
}

Config for Spec

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns default configuration

type Spec

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

Spec wraps OpenAPI specification

func NewSpec

func NewSpec(config Config) *Spec

NewSpec creates a new OpenAPI Spec

func (*Spec) AddServer

func (s *Spec) AddServer(url, description string)

AddServer adds a server

func (*Spec) MarshalJSON

func (s *Spec) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON format of OpenAPI spec

func (*Spec) RegisterOperation

func (s *Spec) RegisterOperation(method, path, summary, description string, tags []string, reqType, respType any)

RegisterOperation registers an operation to OpenAPI spec

func (*Spec) SetInfo

func (s *Spec) SetInfo(title, description, version string)

SetInfo sets API information

func (*Spec) Spec

func (s *Spec) Spec() *openapi3.T

Spec returns the underlying openapi3.T (read-only, do not modify)

Jump to

Keyboard shortcuts

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