-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrouter_openapi_opts.go
More file actions
42 lines (31 loc) · 1.36 KB
/
router_openapi_opts.go
File metadata and controls
42 lines (31 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package forge
import "github.com/xraph/forge/internal/router"
// OpenAPI route options (additional to those in router.go)
// WithSecurity sets security requirements for a route.
func WithSecurity(schemes ...string) RouteOption {
return router.WithSecurity(schemes...)
}
// WithResponse adds a response definition to the route.
func WithResponse(code int, description string, example any) RouteOption {
return router.WithResponseSchema(code, description, example)
}
// ResponseDef defines a response.
type ResponseDef = router.ResponseDef
// WithRequestBody adds request body documentation.
func WithRequestBody(description string, required bool, example any) RouteOption {
return router.WithRequestBody(description, required, example)
}
// RequestBodyDef defines a request body.
type RequestBodyDef = router.RequestBodyDef
// WithParameter adds a parameter definition.
func WithParameter(name, in, description string, required bool, example any) RouteOption {
return router.WithParameter(name, in, description, required, example)
}
// ParameterDef defines a parameter.
type ParameterDef = router.ParameterDef
// WithExternalDocs adds external documentation link.
func WithExternalDocs(description, url string) RouteOption {
return router.WithExternalDocs(description, url)
}
// ExternalDocsDef defines external documentation.
type ExternalDocsDef = router.ExternalDocsDef