aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/api/workaround.go
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-07-28 16:19:52 +0900
committernsfisis <nsfisis@gmail.com>2024-07-28 17:12:12 +0900
commit0dd94cbea6e857896c46d17493725f97369d99f9 (patch)
tree8d324c16eecfb3fb510488c9339e9c4c4a0692ce /backend/api/workaround.go
parentd24c19963f8d0d17d6db93b418cc9d644693c868 (diff)
downloadiosdc-japan-2024-albatross-0dd94cbea6e857896c46d17493725f97369d99f9.tar.gz
iosdc-japan-2024-albatross-0dd94cbea6e857896c46d17493725f97369d99f9.tar.zst
iosdc-japan-2024-albatross-0dd94cbea6e857896c46d17493725f97369d99f9.zip
refactor: remove /api/ prefix from openapi.yaml
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
+}