diff --git a/starport/pkg/cosmosgen/generate_javascript.go b/starport/pkg/cosmosgen/generate_javascript.go index 2520b6d308..5464152c8e 100644 --- a/starport/pkg/cosmosgen/generate_javascript.go +++ b/starport/pkg/cosmosgen/generate_javascript.go @@ -25,7 +25,7 @@ var ( } jsOpenAPIOut = []string{ - "--openapiv2_out=logtostderr=true,allow_merge=true,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:.", + "--openapiv2_out=logtostderr=true,allow_merge=true,json_names_for_fields=false,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:.", } ) @@ -106,7 +106,7 @@ func (g *jsGenerator) generateModule(ctx context.Context, tsprotoPluginPath, app m.Pkg.Path, includePaths, tsOut, - protoc.Plugin(tsprotoPluginPath), + protoc.Plugin(tsprotoPluginPath, "--ts_proto_opt=snakeToCamel=false"), ) if err != nil { return err diff --git a/starport/pkg/cosmosgen/generate_openapi.go b/starport/pkg/cosmosgen/generate_openapi.go index 77c663ad79..863839c19d 100644 --- a/starport/pkg/cosmosgen/generate_openapi.go +++ b/starport/pkg/cosmosgen/generate_openapi.go @@ -12,7 +12,7 @@ import ( ) var openAPIOut = []string{ - "--openapiv2_out=logtostderr=true,allow_merge=true,fqn_for_openapi_name=true,simple_operation_ids=true,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:.", + "--openapiv2_out=logtostderr=true,allow_merge=true,json_names_for_fields=false,fqn_for_openapi_name=true,simple_operation_ids=true,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:.", } func generateOpenAPISpec(g *generator) error { diff --git a/starport/pkg/cosmosgen/templates/vuex/store/index.ts.tpl b/starport/pkg/cosmosgen/templates/vuex/store/index.ts.tpl index 6ddd8004f7..fa6c862cc7 100644 --- a/starport/pkg/cosmosgen/templates/vuex/store/index.ts.tpl +++ b/starport/pkg/cosmosgen/templates/vuex/store/index.ts.tpl @@ -1,6 +1,4 @@ import { txClient, queryClient, MissingWalletError , registry} from './module' -// @ts-ignore -import { SpVuexError } from '@starport/vuex' {{ range .Module.Types }}import { {{ .Name }} } from "./module/types/{{ resolveFile .FilePath }}" {{ end }} @@ -110,7 +108,7 @@ export default { const sub=JSON.parse(subscription) await dispatch(sub.action, sub.payload) }catch(e) { - throw new SpVuexError('Subscriptions: ' + e.message) + throw new Error('Subscriptions: ' + e.message) } }) }, @@ -156,7 +154,7 @@ export default { if (subscribe) commit('SUBSCRIBE', { action: '{{ $FullName }}{{ $n }}', payload: { options: { all }, params: {...key},query }}) return getters['get{{ $Name }}']( { params: {...key}, query}) ?? {} } catch (e) { - throw new SpVuexError('QueryClient:{{ $FullName }}{{ $n }}', 'API Node Unavailable. Could not perform query: ' + e.message) + throw new Error('QueryClient:{{ $FullName }}{{ $n }} API Node Unavailable. Could not perform query: ' + e.message) } }, @@ -171,9 +169,9 @@ export default { return result } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:{{ .Name }}:Init', 'Could not initialize signing client. Wallet is required.') + throw new Error('TxClient:{{ .Name }}:Init Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:{{ .Name }}:Send', 'Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:{{ .Name }}:Send Could not broadcast Tx: '+ e.message) } } }, @@ -185,9 +183,9 @@ export default { return msg } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:{{ .Name }}:Init', 'Could not initialize signing client. Wallet is required.') + throw new Error('TxClient:{{ .Name }}:Init Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:{{ .Name }}:Create', 'Could not create message: ' + e.message) + throw new Error('TxClient:{{ .Name }}:Create Could not create message: ' + e.message) } } diff --git a/starport/pkg/protoc/protoc.go b/starport/pkg/protoc/protoc.go index 06b5e3d018..f2b6705131 100644 --- a/starport/pkg/protoc/protoc.go +++ b/starport/pkg/protoc/protoc.go @@ -22,12 +22,14 @@ type Option func(*configs) type configs struct { pluginPath string isGeneratedDepsEnabled bool + pluginOptions []string } // Plugin configures a plugin for code generation. -func Plugin(path string) Option { +func Plugin(path string, options ...string) Option { return func(c *configs) { c.pluginPath = path + c.pluginOptions = options } } @@ -73,6 +75,7 @@ func Command() (command Cmd, cleanup func(), err error) { // Generate generates code into outDir from protoPath and its includePaths by using plugins provided with protocOuts. func Generate(ctx context.Context, outDir, protoPath string, includePaths, protocOuts []string, options ...Option) error { c := configs{} + for _, o := range options { o(&c) } @@ -89,7 +92,6 @@ func Generate(ctx context.Context, outDir, protoPath string, includePaths, proto if c.pluginPath != "" { command = append(command, "--plugin", c.pluginPath) } - var existentIncludePaths []string // skip if a third party proto source actually doesn't exist on the filesystem. @@ -115,6 +117,7 @@ func Generate(ctx context.Context, outDir, protoPath string, includePaths, proto for _, out := range protocOuts { command := append(command, out) command = append(command, files...) + command = append(command, c.pluginOptions...) if err := exec.Exec(ctx, command, exec.StepOption(step.Workdir(outDir)),