ignite / cli

Ignite is a CLI tool and hub designed for constructing Proof of Stake Blockchains rooted in Cosmos-SDK
https://ignite.com
Other
1.26k stars 547 forks source link

scaffold: rename proto package name of scaffolded modules #804

Closed fadeev closed 3 years ago

fadeev commented 3 years ago

Right now if one scaffolds a chain:

starport app github.com/hello/world

They get a proto package proto/world/* that looks like this hello.world.world (user, repo, module). And generated JS client is in ./hello/world/hello.world.world.

Let's consider renaming this to world (module name), so that generated JS code will be in ./hello/world/world.

The only issue I can think of is how will message types look like when sending through CosmJS. If a user scaffolds a module with a very common name, we don't want there to be conflicts with other (imported) modules.

lumtis commented 3 years ago

What's the state of this issue? Removing the repo/username from the package name should solve #745 is it still an issue frontend related?

fadeev commented 3 years ago

@clockworkgr if we renamed scaffolded packages from hello.world.world to world (module name), how would that affect CosmJS type URL string. Will there be conflicts with other modules?

fadeev commented 3 years ago

@ltacker do you see any problems we might encounter if we use short proto package names?

lumtis commented 3 years ago

I'm asking for frontend since I don't have all the context on this side. Related to protobuf I don't see any problem, for Go package is only used to avoid name clashing in not used in code generation: https://developers.google.com/protocol-buffers/docs/proto#packages

lumtis commented 3 years ago

Btw if package influences frontend code generation, wouldn't be possible to change that in the future and use an option for the concerned feature?

Like Java for example:

In Java, the package is used as the Java package, unless you explicitly provide a option java_package in your .proto file.

fadeev commented 3 years ago

@ltacker let's keep our proto package names long: user.repo.module.

lumtis commented 3 years ago

👍 I still want to know if package affects the frontend because to solve https://github.com/tendermint/starport/issues/745 we could just add a prefix like "_" if the username starts with a number

@fadeev @clockworkgr

fadeev commented 3 years ago

I don't think adding an underscore is an obvious solution. Maybe just omitting numbers.

lumtis commented 3 years ago

A username can also be just numbers

fadeev commented 3 years ago

True. I guess then having an underscore prefix is a good compromise. It is an edge-case, after all.

lumtis commented 3 years ago

@ltacker let's keep our proto package names long: user.repo.module.