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

Consider moving schema boilerplate from examples to a binary crate #755

Closed
uint opened this issue Jul 18, 2022 · 4 comments · Fixed by #760
Closed

Consider moving schema boilerplate from examples to a binary crate #755

uint opened this issue Jul 18, 2022 · 4 comments · Fixed by #760
Milestone

Comments

@uint
Copy link
Contributor

uint commented Jul 18, 2022

In contracts, we have a tradition of keeping schema.rs in examples/. Since schema.rs is not an example at all (it generates an important build artifact!), it's a confusing layout and probably not the proper place for this code.

With very minimal changes, it's possible to move examples/schema.rs to src/bin/schema.rs and have it work pretty much the same - with cargo schema or cargo run --bin schema generating the schemas.

What do you think?

@hashedone
Copy link
Contributor

I was thinking about it at some point and I don't think I found any reason not to. I guess that the initial reason why it put in examples was that it requires less setup - literally: no setup, while as binary you have to play around with Cargo.toml and you may not want to read this doc for POC, and then you leave it. I have the same issue with check_contract binary except it bothers me way more there as I really want to install it on my machine with cargo install and installing it with --example seems off and strange (not a problem for me, but it is how it might be seen from the outside).

@uint
Copy link
Contributor Author

uint commented Jul 18, 2022

while as binary you have to play around with Cargo.toml

I thought so too, but actually I tested this today and Rust autodetects the binary crate if it's in /src/bin. There's pretty much no extra setup compared to examples/schema.rs.

@uint
Copy link
Contributor Author

uint commented Jul 18, 2022

I have the same issue with check_contract binary except it bothers me way more there as I really want to install it on my machine with cargo install and installing it with --example seems off and strange (not a problem for me, but it is how it might be seen from the outside).

I didn't even realize it's an example! Huh. I agree.

@uint
Copy link
Contributor Author

uint commented Jul 20, 2022

@hashedone I opened a ticket for the check_contract issue: CosmWasm/cosmwasm#1371. It bothers me too now 😁

@ethanfrey ethanfrey added this to the v0.15.0 milestone Aug 15, 2022
@uint uint closed this as completed in #760 Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants