Hi @Alex Crichton ! I’m adding support for @since and @unstable to wit-bindgen-go
and had a couple questions:
wit-bindgen-go
shells out to wasm-tools component wit -j
to parse WIT into JSON. The addition of feature gates means that the caller must pass in specific --features a,b,c
arguments in order for the emitted JSON to faithfully represent the original WIT. Would you be amenable to a change that effectively enables --all-features
when converting the WIT to JSON?serde
) for the Stability
enum is inconsistent with other enums used in a Resolve
, e.g. your commit added tag = "type"
, which emits the following JSON:{ "type": "unstable", "feature": "foo" }
TL;DR: In the Go representation (wasm-tools-go
), enums are represented as a Go interface, with a set of types that implement that interface. Parsing the JSON with tag = "type"
is trickier because it requires an intermediate representation before finalizing to one of the cases.
Would you accept a patch that makes it consistent with other enums? e.g.:
{ "unstable": { "feature": "foo" } }
The change is effectively changing crates/wit-parser/lib.rs:830 to:
#[cfg_attr(feature = "serde", serde(rename_all = "lowercase"))]
Both changes sound reasonable to me! I was thinking as well that we'll want --all-features
but I ended up forgetting to add that, so would be great to add :+1:. Also happy to change the JSON output if you find an alternative structure easier to parse. Would you like to send a PR for these changes? If not that's ok and I can try to find some time next week as well
JSON schema PR done: https://github.com/bytecodealliance/wasm-tools/pull/1598
And second PR that adds --all-features
. Confirmed this works via uncommitted changes to wit-bindgen-go
. Happy to take feedback on the coding style.
https://github.com/bytecodealliance/wasm-tools/pull/1599
Thanks for this!
Randy Reddig has marked this topic as resolved.
@Alex Crichton when’s the next warm-tools
scheduled release?
Ah I tried to document that here in that there's no release cadence right now, it's all request-based at this time, but I can go kick it off
apologies I forgot to hit approve until just now
Last updated: Nov 22 2024 at 16:03 UTC