Skip to content

Commit 0cc73ba

Browse files
authored
feat(server/v2): add swagger server component (#23486)
1 parent 5e58330 commit 0cc73ba

File tree

14 files changed

+2617
-2656
lines changed

14 files changed

+2617
-2656
lines changed

client/docs/config.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,6 @@
8080
}
8181
}
8282
},
83-
{
84-
"url": "./tmp-swagger-gen/cosmos/params/v1beta1/query.swagger.json",
85-
"operationIds": {
86-
"rename": {
87-
"Params": "Params"
88-
}
89-
}
90-
},
9183
{
9284
"url": "./tmp-swagger-gen/cosmos/slashing/v1beta1/query.swagger.json",
9385
"operationIds": {
@@ -174,6 +166,15 @@
174166
},
175167
{
176168
"url": "./tmp-swagger-gen/cosmos/app/v1alpha1/query.swagger.json"
169+
},
170+
{
171+
"url": "./tmp-swagger-gen/cosmos/protocolpool/v1/query.swagger.json",
172+
"operationIds": {
173+
"rename": {
174+
"Params": "ProtocolPoolParams",
175+
"CommunityPool": "ProtocolPoolCommunityPool"
176+
}
177+
}
177178
}
178179
]
179-
}
180+
}

client/docs/embed.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
package docs
22

3-
import "embed"
3+
import (
4+
"embed"
5+
"io/fs"
6+
)
47

58
//go:embed swagger-ui
69
var SwaggerUI embed.FS
10+
11+
// GetSwaggerFS returns the embedded Swagger UI filesystem
12+
func GetSwaggerFS() fs.FS {
13+
root, err := fs.Sub(SwaggerUI, "swagger-ui")
14+
if err != nil {
15+
panic(err)
16+
}
17+
18+
return root
19+
}

client/docs/swagger-ui/index.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
<!doctype html> <!-- Important: must specify -->
1+
<!DOCTYPE html>
22
<html>
33
<head>
4-
<meta charset="utf-8"> <!-- Important: rapi-doc uses utf8 characters -->
4+
<meta charset="utf-8" />
5+
<!-- Important: rapi-doc uses utf8 characters -->
56
<script type="module" src="rapidoc-min.js"></script>
67
</head>
78
<body>
8-
<rapi-doc spec-url = "swagger.yaml"> </rapi-doc>
9+
<rapi-doc spec-url="swagger.yaml" server-url="http://localhost:1317">
10+
</rapi-doc>
911
</body>
1012
</html>

0 commit comments

Comments
 (0)