-
Notifications
You must be signed in to change notification settings - Fork 547
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: find Cosmos SDK runtime app registered modules (#3661)
* fix: find Cosmos SDK runtime app registered modules These modules are required to properly generate OpenAPI specs. * chore: update changelog * chore: remove empty test definition
- Loading branch information
1 parent
f210829
commit fa47220
Showing
7 changed files
with
318 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
ignite/pkg/cosmosanalysis/app/testdata/modules/runtime_api_routes/app.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package app | ||
|
||
import ( | ||
"cosmossdk.io/api/tendermint/abci" | ||
"cosmossdk.io/client/v2/autocli" | ||
"github.com/cosmos/cosmos-sdk/client" | ||
codectypes "github.com/cosmos/cosmos-sdk/codec/types" | ||
"github.com/cosmos/cosmos-sdk/runtime" | ||
"github.com/cosmos/cosmos-sdk/server/api" | ||
"github.com/cosmos/cosmos-sdk/server/config" | ||
storetypes "github.com/cosmos/cosmos-sdk/store/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
"github.com/cosmos/cosmos-sdk/x/auth" | ||
"github.com/cosmos/cosmos-sdk/x/bank" | ||
"github.com/cosmos/cosmos-sdk/x/gov" | ||
govclient "github.com/cosmos/cosmos-sdk/x/gov/client" | ||
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" | ||
"github.com/cosmos/cosmos-sdk/x/staking" | ||
foomodule "github.com/username/test/x/foo" | ||
) | ||
|
||
// App modules are defined as NewBasicManager arguments | ||
var ModuleBasics = module.NewBasicManager( | ||
auth.AppModuleBasic{}, | ||
bank.AppModuleBasic{}, | ||
staking.AppModuleBasic{}, | ||
gov.NewAppModuleBasic([]govclient.ProposalHandler{ | ||
paramsclient.ProposalHandler, | ||
}), | ||
foomodule.AppModuleBasic{}, | ||
) | ||
|
||
type Foo struct { | ||
*runtime.App | ||
} | ||
|
||
func (Foo) Name() string { return "foo" } | ||
func (Foo) InterfaceRegistry() codectypes.InterfaceRegistry { return nil } | ||
func (Foo) TxConfig() client.TxConfig { return nil } | ||
func (Foo) AutoCliOpts() autocli.AppOptions { return autocli.AppOptions{} } | ||
|
||
func (Foo) BeginBlocker(sdk.Context, abci.RequestBeginBlock) abci.ResponseBeginBlock { | ||
return abci.ResponseBeginBlock{} | ||
} | ||
|
||
func (Foo) EndBlocker(sdk.Context, abci.RequestEndBlock) abci.ResponseEndBlock { | ||
return abci.ResponseEndBlock{} | ||
} | ||
|
||
func (app *Foo) RegisterAPIRoutes(s *api.Server, cfg config.APIConfig) { | ||
// This module should be discovered | ||
foomodule.RegisterGRPCGatewayRoutes(s.ClientCtx, s.GRPCGatewayRouter) | ||
// Runtime app modules for the current Cosmos SDK should be discovered too | ||
app.App.RegisterAPIRoutes(apiSvr, apiConfig) | ||
} | ||
|
||
func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } | ||
|
||
func (Foo) TxConfig() client.TxConfig { return nil } |
37 changes: 37 additions & 0 deletions
37
ignite/pkg/cosmosanalysis/app/testdata/modules/runtime_api_routes/go.mod
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module app | ||
|
||
go 1.20 | ||
|
||
require ( | ||
cosmossdk.io/api v0.3.1 | ||
cosmossdk.io/core v0.5.1 | ||
cosmossdk.io/depinject v1.0.0-alpha.3 | ||
cosmossdk.io/errors v1.0.0-beta.7 | ||
cosmossdk.io/math v1.0.1 | ||
github.com/bufbuild/buf v1.23.1 | ||
github.com/cometbft/cometbft v0.37.2 | ||
github.com/cometbft/cometbft-db v0.8.0 | ||
github.com/cosmos/cosmos-proto v1.0.0-beta.2 | ||
github.com/cosmos/cosmos-sdk v0.47.3 | ||
github.com/cosmos/gogoproto v1.4.10 | ||
github.com/cosmos/ibc-go/v7 v7.2.0 | ||
github.com/golang/protobuf v1.5.3 | ||
github.com/gorilla/mux v1.8.0 | ||
github.com/grpc-ecosystem/grpc-gateway v1.16.0 | ||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 | ||
github.com/spf13/cast v1.5.1 | ||
github.com/spf13/cobra v1.7.0 | ||
github.com/spf13/pflag v1.0.5 | ||
github.com/stretchr/testify v1.8.4 | ||
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 | ||
google.golang.org/grpc v1.55.0 | ||
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 | ||
google.golang.org/protobuf v1.31.0 | ||
) | ||
|
||
replace ( | ||
// use cosmos fork of keyring | ||
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 | ||
// replace broken goleveldb | ||
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.