Documentation
¶
Index ¶
- type ContentConfig
- type ContentOption
- type OperationConfig
- type OperationOption
- func Deprecated(deprecated ...bool) OperationOption
- func Description(description string) OperationOption
- func Hide(hide ...bool) OperationOption
- func ID(id string) OperationOption
- func Request(structure any, options ...ContentOption) OperationOption
- func Response(httpStatus int, structure any, options ...ContentOption) OperationOption
- func Security(securityName string, scopes ...string) OperationOption
- func Summary(summary string) OperationOption
- func Tags(tags ...string) OperationOption
- type RouteConfig
- type RouteOption
- type RouteSecurity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContentConfig ¶
type ContentConfig struct {
Structure any
ContentType string
// HTTPStatus can have values 100-599 for single status, or 1-5 for status families (e.g. 2XX)
HTTPStatus int
}
ContentConfig defines the structure for OpenAPI content configuration.
type ContentOption ¶
type ContentOption func(cu *ContentConfig)
ContentOption is a function that modifies the ContentConfig.
func WithContentType ¶
func WithContentType(contentType string) ContentOption
WithContentType sets the content type for the OpenAPI content.
type OperationConfig ¶
type OperationConfig struct {
Hide bool
OperationID string
Description string
Summary string
Deprecated bool
Tags []string
Security []RouteSecurity
Requests []*ContentConfig
Responses []*ContentConfig
}
OperationConfig holds the configuration for an OpenAPI operation.
type OperationOption ¶
type OperationOption func(*OperationConfig)
Operation is a function that configures an OpenAPI operation.
func Deprecated ¶
func Deprecated(deprecated ...bool) OperationOption
Deprecated marks the operation as deprecated in the OpenAPI documentation.
func Description ¶
func Description(description string) OperationOption
Description sets the description for the OpenAPI operation.
func Hide ¶
func Hide(hide ...bool) OperationOption
Hide marks the operation as hidden in the OpenAPI documentation. This is useful for operations that should not be exposed to the public API.
func Request ¶
func Request(structure any, options ...ContentOption) OperationOption
Request adds a request structure to the OpenAPI operation.
func Response ¶
func Response(httpStatus int, structure any, options ...ContentOption) OperationOption
Response adds a response structure to the OpenAPI operation.
func Security ¶
func Security(securityName string, scopes ...string) OperationOption
Security adds security requirements to the OpenAPI operation.
func Summary ¶
func Summary(summary string) OperationOption
Summary sets the summary for the OpenAPI operation.
type RouteConfig ¶
type RouteConfig struct {
Name string
Tags []string
Security []RouteSecurity
Hide bool
}
Operation is a function that configures an OpenAPI operation.
type RouteOption ¶
type RouteOption func(*RouteConfig)
RouteOption is a function that applies configuration to a RouteConfig.
func WithRouteHide ¶
func WithRouteHide(hide ...bool) RouteOption
WithRouteHide marks the route as hidden in the OpenAPI documentation. This is useful for routes that should not be exposed to the public API.
It will hide all routes in the sub-router. If you want to hide only specific routes, use the `With` method on the route
func WithRouteName ¶
func WithRouteName(name string) RouteOption
WithRouteName sets the name for the route.
func WithRouteSecurity ¶
func WithRouteSecurity(securityName string, scopes ...string) RouteOption
WithRouteSecurity adds security schemes to the route.
It will add security schemes to all routes in the sub-router.
func WithRouteTags ¶
func WithRouteTags(tags ...string) RouteOption
WithRouteTags adds tags to the route.
It will add tags to all routes in the sub-router.