openapi

package
v0.0.0-...-a5c2bed Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Info     Info                      `json:"info"`
	Servers  []Server                  `json:"servers,omitempty"`
	Security map[string]SecurityScheme `json:"security,omitempty"`
}

Config holds OpenAPI generation configuration.

type Contact

type Contact struct {
	Name  string `json:"name,omitempty"`
	URL   string `json:"url,omitempty"`
	Email string `json:"email,omitempty"`
}

Contact represents OpenAPI contact object.

type Generator

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

Generator generates OpenAPI specifications from TypedHTTP routers.

func NewGenerator

func NewGenerator(config *Config) *Generator

NewGenerator creates a new OpenAPI generator.

func (*Generator) Generate

func (g *Generator) Generate(router *typedhttp.TypedRouter) (*openapi3.T, error)

Generate creates an OpenAPI specification from a TypedHTTP router.

func (*Generator) GenerateJSON

func (g *Generator) GenerateJSON(spec *openapi3.T) ([]byte, error)

GenerateJSON generates JSON representation of OpenAPI spec.

func (*Generator) GenerateYAML

func (g *Generator) GenerateYAML(spec *openapi3.T) ([]byte, error)

GenerateYAML generates YAML representation of OpenAPI spec.

type Info

type Info struct {
	Title          string   `json:"title"`
	Version        string   `json:"version"`
	Description    string   `json:"description,omitempty"`
	TermsOfService string   `json:"terms_of_service,omitempty"`
	Contact        *Contact `json:"contact,omitempty"`
	License        *License `json:"license,omitempty"`
}

Info represents OpenAPI info object.

type License

type License struct {
	Name string `json:"name"`
	URL  string `json:"url,omitempty"`
}

License represents OpenAPI license object.

type SecurityScheme

type SecurityScheme struct {
	Type         string `json:"type"`
	Scheme       string `json:"scheme,omitempty"`
	BearerFormat string `json:"bearer_format,omitempty"`
	In           string `json:"in,omitempty"`
	Name         string `json:"name,omitempty"`
}

SecurityScheme represents OpenAPI security scheme.

type Server

type Server struct {
	URL         string `json:"url"`
	Description string `json:"description,omitempty"`
}

Server represents OpenAPI server object.

Jump to

Keyboard shortcuts

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