aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/api/workaround.go
diff options
context:
space:
mode:
Diffstat (limited to 'backend/api/workaround.go')
-rw-r--r--backend/api/workaround.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/backend/api/workaround.go b/backend/api/workaround.go
new file mode 100644
index 0000000..a3c47d7
--- /dev/null
+++ b/backend/api/workaround.go
@@ -0,0 +1,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
+ }
+
+ var prefixedPaths openapi3.Paths = openapi3.Paths{}
+ for key, value := range spec.Paths.Map() {
+ prefixedPaths.Set(prefix+key, value)
+ }
+
+ spec.Paths = &prefixedPaths
+ return spec, nil
+}