-o toon leaks ,omitzero into key names (gotoon uses full json tag)
- Dominant language
- Go
- Stars
- 1
- Forks
- 0
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 18
Description
## Bug
`-o toon` leaks the Go struct-tag option into key names, e.g. `"description,omitzero"` instead of `description`. Fields whose `json` tag has no option (e.g. `json:"id"`) render clean.
## Root cause (dependency + Speakeasy)
`gotoon` v0.1.1 (`normalize.go`) uses the *entire* raw `json` tag value as the key without splitting on `,` to strip options. Speakeasy emits the Go 1.24 `,omitzero` option on every optional field, so those keys carry the suffix. Root cause is the `github.com/alpkeskin/gotoon` dependency; Speakeasy owns it as the chooser/shipper.
## Stopgap fix (retire when upstream is fixed)
Lives in `.speakeasy/patches/internal/output/output.go.patch`: the same `toGeneric` helper (JSON round-trip) is applied in the `case "toon"` arm, so `gotoon.Encode` receives a generic map whose keys are already clean strings rather than the typed struct.
**To retire:** once `gotoon` strips tag options (or Speakeasy upgrades/replaces it), remove the `case "toon"` hunk (and the shared `toGeneric` helper if the yaml fix above is also retired) from `output.go.patch` and regenerate.
## Refs
- Introduced by #14
- Upstream: file to speakeasy-api/speakeasy; the underlying dep bug is alpkeskin/gotoon.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with .speakeasy/patches/internal/output/output.go.patch and inspect the toon case and shared toGeneric helper. Compare that workaround with gotoon v0.1.1 normalize.go and check whether the upstream dependency still uses the full json tag. Done means toon output has clean keys and the workaround is retired only after the dependency or Speakeasy upgrade makes it unnecessary.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100