meta

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ScalarUITemplate string
View Source
var SwaggerUITemplate string

Functions

func GenerateOpenAPI

func GenerateOpenAPI() []byte

GenerateOpenAPI generates an OpenAPI 3.0 JSON specification from all registered route metadata.

func Register

func Register(metas ...RouteMeta)

Register adds or updates one or more RouteMeta entries in the radix tree. If a route with the same Method+Path already exists, its fields are merged (non-zero fields in the new entry override the existing ones). This allows Handle() to register basic metadata (method, path) first, and contract-based Mount() to enrich it later with ReqType/RespType/Tag.

func Reset

func Reset()

Reset clears all registered metadata. Useful for testing.

func ScalarUIHTML

func ScalarUIHTML(jsonURL string) string

ScalarUIHTML returns the Scalar API Reference HTML page pointing to the given openapi.json URL.

func SwaggerUIHTML

func SwaggerUIHTML(jsonURL string) string

SwaggerUIHTML returns the Swagger UI HTML page pointing to the given openapi.json URL.

Types

type RouteMeta

type RouteMeta struct {
	Method   string
	Path     string
	ReqType  reflect.Type
	RespType reflect.Type
	Tag      string // using for service name => open api tag
}

RouteMeta holds metadata for a registered route, useful for generating OpenAPI documentation.

func All

func All() []RouteMeta

All returns all registered route metadata by traversing the radix trees.

Jump to

Keyboard shortcuts

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