Skip to content

Commit

Permalink
feat(server/v2): add swagger server component (#23486)
Browse files Browse the repository at this point in the history
(cherry picked from commit 0cc73ba)

# Conflicts:
#	server/v2/CHANGELOG.md
#	server/v2/api/grpcgateway/handler.go
#	server/v2/api/grpcgateway/server.go
#	server/v2/api/telemetry/server.go
#	simapp/v2/simdv2/cmd/commands.go
  • Loading branch information
julienrbrt authored and mergify[bot] committed Jan 24, 2025
1 parent 36e0cbe commit de9265e
Show file tree
Hide file tree
Showing 14 changed files with 3,506 additions and 2,649 deletions.
19 changes: 10 additions & 9 deletions client/docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,6 @@
}
}
},
{
"url": "./tmp-swagger-gen/cosmos/params/v1beta1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "Params"
}
}
},
{
"url": "./tmp-swagger-gen/cosmos/slashing/v1beta1/query.swagger.json",
"operationIds": {
Expand Down Expand Up @@ -174,6 +166,15 @@
},
{
"url": "./tmp-swagger-gen/cosmos/app/v1alpha1/query.swagger.json"
},
{
"url": "./tmp-swagger-gen/cosmos/protocolpool/v1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "ProtocolPoolParams",
"CommunityPool": "ProtocolPoolCommunityPool"
}
}
}
]
}
}
15 changes: 14 additions & 1 deletion client/docs/embed.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
package docs

import "embed"
import (
"embed"
"io/fs"
)

//go:embed swagger-ui
var SwaggerUI embed.FS

// GetSwaggerFS returns the embedded Swagger UI filesystem
func GetSwaggerFS() fs.FS {
root, err := fs.Sub(SwaggerUI, "swagger-ui")
if err != nil {
panic(err)
}

return root
}
8 changes: 5 additions & 3 deletions client/docs/swagger-ui/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<!doctype html> <!-- Important: must specify -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> <!-- Important: rapi-doc uses utf8 characters -->
<meta charset="utf-8" />
<!-- Important: rapi-doc uses utf8 characters -->
<script type="module" src="rapidoc-min.js"></script>
</head>
<body>
<rapi-doc spec-url = "swagger.yaml"> </rapi-doc>
<rapi-doc spec-url="swagger.yaml" server-url="http://localhost:1317">
</rapi-doc>
</body>
</html>
Loading

0 comments on commit de9265e

Please sign in to comment.