doc

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*v3.Document, *store.Store)

Option configures an OpenAPI document.

func Contact

func Contact(name, url, email string) Option

Contact sets the contact information for the API.

func Description

func Description(description string) Option

Description sets the API description.

func ExternalDocs

func ExternalDocs(url, description string) Option

ExternalDocs sets the external documentation for the API.

func License

func License(name, url, identifier string) Option

License sets the license for the API. Provide url for a link to the full license text, or identifier for an SPDX identifier (OpenAPI 3.1). Only one of url or identifier should be set; if both are provided, url takes precedence per the spec.

func Security

func Security(name string, scopes ...string) Option

Security appends a global security requirement. Pass an empty name to add an empty requirement (makes security optional globally).

func SecurityScheme

func SecurityScheme(name string, opts ...securityscheme.Option) Option

SecurityScheme registers a named security scheme in components/securitySchemes.

func Server

func Server(url, description string, opts ...server.Option) Option

Server appends a server to the API document.

func Summary

func Summary(summary string) Option

Summary sets a short summary of the API.

func Tag

func Tag(name, description string, opts ...tag.Option) Option

Tag appends a tag definition to the API document.

func TermsOfService

func TermsOfService(url string) Option

TermsOfService sets the URL to the terms of service.

func Version

func Version(version string) Option

Version sets the OpenAPI specification version. Default: "3.1.0".

func Webhook

func Webhook(name string, pathItem func(*store.Store) *v3.PathItem) Option

Webhook adds a named webhook path to the API document. Pass a builder function such as (*pathitem.Path).PathItem():

p := pathitem.New(...)
p.Operation(http.MethodPost, op.Options(...))
doc.Webhook("user.created", p.PathItem())

Jump to

Keyboard shortcuts

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