Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SwaggerUIHandler ¶
SwaggerUIHandler returns a Fiber handler that serves embedded Swagger UI. specPath is the URL where the openapi.json is located.
Types ¶
type BuildInput ¶
type BuildInput struct {
Title string
Version string
Description string
Contact *Contact
License *License
Servers []ServerInfo
Tags []TagInfo
Routes []RouteInput
}
BuildInput groups the data to build the spec.
type Components ¶
type Components struct {
Schemas map[string]any `json:"schemas,omitempty"`
SecuritySchemes map[string]SecurityScheme `json:"securitySchemes,omitempty"`
}
Components groups reusable schemas and security schemes.
type Contact ¶
type Contact struct {
Name string `json:"name,omitempty"`
URL string `json:"url,omitempty"`
Email string `json:"email,omitempty"`
}
Contact holds API contact information.
type QueryParamInput ¶
QueryParamInput documents a query string parameter.
type RouteInput ¶
type RouteInput struct {
Method string
Path string
Summary string
Description string
Tags []string
Secured []string // security schemes: "bearerAuth", "apiKey", etc.
Body any
Response any
StatusCode int
QueryParams []QueryParamInput
Deprecated bool
}
RouteInput is the neutral representation of a route.
type SecurityScheme ¶
type SecurityScheme struct {
Type string `json:"type"`
Scheme string `json:"scheme,omitempty"`
In string `json:"in,omitempty"`
Name string `json:"name,omitempty"`
BearerFormat string `json:"bearerFormat,omitempty"`
}
SecurityScheme defines an authentication scheme in OpenAPI.
type ServerInfo ¶
type ServerInfo struct {
URL string `json:"url"`
Description string `json:"description,omitempty"`
}
ServerInfo describes an API server.
type Spec ¶
type Spec struct {
OpenAPI string `json:"openapi"`
Info Info `json:"info"`
Servers []ServerInfo `json:"servers,omitempty"`
Tags []TagInfo `json:"tags,omitempty"`
Paths map[string]any `json:"paths"`
Components Components `json:"components"`
Security []map[string][]string `json:"security,omitempty"`
}
Spec is the in-memory representation of an OpenAPI 3.0 spec.
func Build ¶
func Build(input BuildInput) Spec
Build constructs the OpenAPI 3.0 specification from the provided input.
Click to show internal directories.
Click to hide internal directories.