blob: 5b5fe59d9f9b9afaba808a8825dce11303a46114 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
package api
import (
"github.com/getkin/kin-openapi/openapi3"
)
// Work-around for this issue:
// https://stackoverflow.com/questions/70087465/echo-groups-not-working-with-openapi-generated-code-using-oapi-codegen
func GetSwaggerWithPrefix(prefix string) (*openapi3.T, error) {
spec, err := GetSwagger()
if err != nil {
return nil, err
}
prefixedPaths := openapi3.Paths{}
for key, value := range spec.Paths.Map() {
prefixedPaths.Set(prefix+key, value)
}
spec.Paths = &prefixedPaths
return spec, nil
}
|