Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update swagger #299

Merged
merged 6 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Contains all the PRs that improved the code without changing the behaviors.
## Fixed
- Fixed code lint
- Fixed ws client issue with event stream
- Fixed swagger issue

# v1.0.2-Prerelease

Expand Down
9 changes: 5 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package app
import (
"fmt"
"io"
"net/http"
"os"

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
Expand Down Expand Up @@ -64,7 +63,6 @@ import (

"github.com/arkeonetwork/arkeo/app/keepers"
arekoappParams "github.com/arkeonetwork/arkeo/app/params"
"github.com/arkeonetwork/arkeo/docs"

// distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client"
"cosmossdk.io/x/evidence"
Expand Down Expand Up @@ -963,8 +961,11 @@ func (app *ArkeoApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIC
ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)

// register app's OpenAPI routes.
apiSvr.Router.Handle("/static/openapi.yml", http.FileServer(http.FS(docs.Docs)))
// apiSvr.Router.HandleFunc("/", openapiconsole.Handler(AppName, "/static/openapi.yml"))
if apiConfig.Swagger {
if err := RegisterSwaggerAPI(apiSvr); err != nil {
panic(err)
}
}
}

// RegisterTxService implements the Application.RegisterTxService method.
Expand Down
18 changes: 18 additions & 0 deletions app/swagger.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package app

import (
"net/http"

"github.com/cosmos/cosmos-sdk/server/api"

"github.com/arkeonetwork/arkeo/docs"
"github.com/arkeonetwork/arkeo/pkg/openapiconsole"
)

// RegisterSwaggerAPI provides a common function which registers swagger route with API Server
func RegisterSwaggerAPI(apiSvr *api.Server) error {
// register app's OpenAPI routes.
apiSvr.Router.Handle("/static/swagger.min.json", http.FileServer(http.FS(docs.Docs)))
apiSvr.Router.HandleFunc("/swagger", openapiconsole.Handler(AppName+" Swagger UI", "/static/swagger.min.json"))
return nil
}
2 changes: 1 addition & 1 deletion buf.work.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version: v1
directories:
- ./proto
- proto
1 change: 1 addition & 0 deletions docs/TESTNET.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ curl -s http://seed31.innovationtheory.com:26657/genesis | jq '.result.genesis'
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $HOME/.arkeo/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"50\"/" $HOME/.arkeo/config/app.toml
sed -i 's|minimum-gas-prices =.*|minimum-gas-prices = "0.001uarkeo"|g' $HOME/.arkeo/config/app.toml
sed -i 's|swagger =.*| swagger = true|g' $HOME/.arkeo/config/app.toml
```

---
Expand Down
41 changes: 41 additions & 0 deletions docs/proto/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"swagger": "2.0",
"info": {
"title": "Arkeo - gRPC Gateway docs",
"description": "A REST interface for state queries. \nUsing Cosmos SDK [{sdk-version}](https://github.com/cosmos/cosmos-sdk/releases/tag/{sdk-version})",
"version": "{arkeo-version}"
},
"apis": [

{
"url": "./tmp-swagger-gen/arkeo/arkeo/query.swagger.json",
"tags": {
"add": ["Arkeo"]
},
"operationIds": {
"rename": {
"Params": "ArkeoParams"
}
}
},
{
"url": "./tmp-swagger-gen/arkeo/claim/query.swagger.json",
"tags": {
"add": ["Claim"]
},
"operationIds": {
"rename": {
"Params": "ClaimParams"
}
}
},
{
"url": "https://raw.githubusercontent.com/cosmos/cosmos-sdk/{sdk-version}/client/docs/swagger-ui/swagger.yaml",
"tags": {
"add": ["Cosmos"]
}
}


]
}
1 change: 0 additions & 1 deletion docs/static/openapi.yml

This file was deleted.

Loading
Loading