Skip to content

Commit

Permalink
Merge pull request #1805 from CosmWasm/go-codegen
Browse files Browse the repository at this point in the history
Code Generator for Go Types
  • Loading branch information
webmaster128 authored Aug 24, 2023
2 parents c151a84 + 6877bb3 commit 05ece0b
Show file tree
Hide file tree
Showing 25 changed files with 1,485 additions and 20 deletions.
68 changes: 48 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions packages/go-gen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "go-gen"
authors = ["Christoph Otter <[email protected]>"]
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
schemars = "0.8.3"
cosmwasm-std = { path = "../std", version = "1.3.1", features = ["cosmwasm_1_3", "staking", "stargate", "ibc3"] }
cosmwasm-schema = { path = "../schema", version = "1.3.1" }
anyhow = "1"
Inflector = "0.11.4"
indenter = "0.3.3"
21 changes: 21 additions & 0 deletions packages/go-gen/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# JsonSchema Go Type Generator

This is an internal utility to generate Go types from `cosmwasm-std`'s query
response types. These types can then be used in
[wasmvm](https://github.com/CosmWasm/wasmvm).

## Usage

Adjust the query / response type you want to generate in `src/main.rs` and run:
`cargo run -p go-gen`

## Limitations

Only basic structs and enums are supported. Tuples and enum variants with 0 or
more than 1 parameters don't work, for example.

## License

This package is part of the cosmwasm repository, licensed under the Apache
License 2.0 (see [NOTICE](https://github.com/CosmWasm/cosmwasm/blob/main/NOTICE)
and [LICENSE](https://github.com/CosmWasm/cosmwasm/blob/main/LICENSE)).
Loading

0 comments on commit 05ece0b

Please sign in to comment.