Help us shape the future of Go! Take the 2026 Go Developer Survey

docs

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() ports.DocsManager

New creates a new docs manager with default configuration.

func NewWithConfig

func NewWithConfig(config ports.DocsConfig) ports.DocsManager

NewWithConfig creates a new docs manager with custom configuration.

Types

type Handler

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

Handler provides HTTP handlers for documentation endpoints.

func NewDefaultHandler

func NewDefaultHandler() *Handler

NewDefaultHandler builds a handler using the default docs manager.

func NewHandler

func NewHandler(manager ports.DocsManager) *Handler

NewHandler creates a new docs handler.

func (*Handler) HTMLHandler

func (h *Handler) HTMLHandler(w http.ResponseWriter, r *http.Request)

HTMLHandler handles HTML documentation requests. @Summary API Documentation @Description Returns the API documentation page @Tags docs @Accept html @Produce html @Success 200 {string} string "HTML documentation page" @Router /docs [get]

func (*Handler) InfoHandler

func (h *Handler) InfoHandler(w http.ResponseWriter, r *http.Request)

InfoHandler handles info requests.

func (*Handler) Middleware

func (h *Handler) Middleware() func(http.Handler) http.Handler

Middleware creates a middleware that adds documentation information to requests.

func (*Handler) OpenAPIHandler

func (h *Handler) OpenAPIHandler(w http.ResponseWriter, r *http.Request)

OpenAPIHandler handles OpenAPI specification requests. @Summary OpenAPI Specification @Description Returns the OpenAPI specification in JSON format @Tags docs @Accept json @Produce json @Success 200 {object} map[string]interface{} "OpenAPI specification" @Failure 404 {object} map[string]interface{} "OpenAPI specification not found" @Router /docs/openapi.json [get]

func (*Handler) RegisterCustomRoutes

func (h *Handler) RegisterCustomRoutes(router interface {
	Get(pattern string, h http.HandlerFunc)
}, paths ports.DocsPaths)

RegisterCustomRoutes registers documentation endpoints with custom paths.

func (*Handler) RegisterRoutes

func (h *Handler) RegisterRoutes(router interface {
	Get(pattern string, h http.HandlerFunc)
})

RegisterRoutes registers all documentation endpoints on the given router.

func (*Handler) VersionHandler

func (h *Handler) VersionHandler(w http.ResponseWriter, r *http.Request)

VersionHandler handles version requests.

type Manager

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

Manager implements ports.DocsManager for managing documentation.

func (*Manager) GetHTML

func (m *Manager) GetHTML() (string, error)

GetHTML returns the HTML documentation.

func (*Manager) GetInfo

func (m *Manager) GetInfo() ports.DocsInfo

GetInfo returns the documentation info.

func (*Manager) GetOpenAPI

func (m *Manager) GetOpenAPI() ([]byte, error)

GetOpenAPI returns the OpenAPI specification.

func (*Manager) GetVersion

func (m *Manager) GetVersion() (string, error)

GetVersion returns the API version.

func (*Manager) RegisterProvider

func (m *Manager) RegisterProvider(provider ports.DocsProvider)

RegisterProvider registers a documentation provider.

func (*Manager) ServeHTML

func (m *Manager) ServeHTML(w http.ResponseWriter, r *http.Request)

ServeHTML serves the HTML documentation.

func (*Manager) ServeInfo

func (m *Manager) ServeInfo(w http.ResponseWriter, r *http.Request)

ServeInfo serves the documentation info.

func (*Manager) ServeOpenAPI

func (m *Manager) ServeOpenAPI(w http.ResponseWriter, r *http.Request)

ServeOpenAPI serves the OpenAPI specification.

func (*Manager) ServeVersion

func (m *Manager) ServeVersion(w http.ResponseWriter, r *http.Request)

ServeVersion serves the API version.

Jump to

Keyboard shortcuts

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