godoclive

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package godoclive provides a public API for analyzing Go HTTP services and generating interactive API documentation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(endpoints []EndpointDef, opts ...Option) error

Generate creates documentation output from analyzed endpoints.

func GenerateOpenAPI

func GenerateOpenAPI(endpoints []EndpointDef, opts ...Option) ([]byte, error)

GenerateOpenAPI generates an OpenAPI 3.1.0 spec from analyzed endpoints and returns the JSON bytes. Options Title and Version are used for the spec info.

Types

type EndpointDef

type EndpointDef = model.EndpointDef

EndpointDef is the public type alias for the analyzed endpoint contract.

func Analyze

func Analyze(dir, pattern string, opts ...Option) ([]EndpointDef, error)

Analyze runs the analysis pipeline on the given Go packages and returns the extracted endpoint contracts. The pattern should be a directory path with an optional package pattern suffix (e.g. "./..." or "./cmd/...").

type Option

type Option func(*Options)

Option is a functional option for configuring Analyze and Generate.

func WithBaseURL

func WithBaseURL(url string) Option

WithBaseURL sets the pre-filled base URL in Try It.

func WithConfig

func WithConfig(cfg *config.Config) Option

WithConfig sets the project configuration.

func WithDescription

func WithDescription(description string) Option

WithDescription sets the API description in the OpenAPI spec info block.

func WithFormat

func WithFormat(format string) Option

WithFormat sets the output format ("folder" or "single").

func WithOpenAPIOutput

func WithOpenAPIOutput(path string) Option

WithOpenAPIOutput sets the output path for an OpenAPI spec file.

func WithOutput

func WithOutput(path string) Option

WithOutput sets the output directory path.

func WithTheme

func WithTheme(theme string) Option

WithTheme sets the default theme ("light" or "dark").

func WithTitle

func WithTitle(title string) Option

WithTitle sets the project title displayed in the documentation.

func WithVersion

func WithVersion(version string) Option

WithVersion sets the project version displayed in the documentation.

type Options

type Options struct {
	Config        *config.Config
	OutputPath    string
	Format        string // "folder" or "single"
	Title         string
	Description   string
	Version       string
	BaseURL       string
	Theme         string // "light" or "dark"
	OpenAPIOutput string // path for OpenAPI spec output
}

Options configures the behavior of Analyze and Generate.

Jump to

Keyboard shortcuts

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