-o yaml lowercases all keys (models lack yaml tags)
- Dominant language
- Go
- Stars
- 1
- Forks
- 0
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 18
Description
## Bug
`-o yaml` lowercases every key (`dateCreated` → `datecreated`), so YAML output doesn't match the documented (JSON) field names.
## Root cause (Speakeasy-generated code)
`internal/output/output.go` `Result()` marshals the typed SDK struct directly with `yaml.Marshal(content)`. The generated models carry only `json:` tags (no `yaml:` tags), so `gopkg.in/yaml.v3` falls back to the lowercased Go field name. The `--include-headers` path was already correct because it round-trips through JSON first; only the plain switch was affected.
## Stopgap fix (retire when upstream is fixed)
Lives in `.speakeasy/patches/internal/output/output.go.patch`: a shared `toGeneric` helper JSON-round-trips `content` to a generic value (so `json` tags win) before `yaml.Marshal`, applied in the `case "yaml"` arm.
**To retire:** once Speakeasy emits `yaml:` tags on models (or JSON-round-trips YAML output itself), remove the `case "yaml"` hunk (and the shared `toGeneric` helper if the toon fix below is also retired) from `output.go.patch` and regenerate.
## Refs
- Introduced by #14
- Upstream generator bug — should also be filed to speakeasy-api/speakeasy.
Contributor guide
No contributing guide indexed for this repository
Research direction
Read internal/output/output.go and .speakeasy/patches/internal/output/output.go.patch, starting at Result() and the yaml case. Verify that plain -o yaml preserves documented JSON field names such as dateCreated while --include-headers remains unchanged. Done means the stopgap or upstream-generated tags produce matching field names, with the patch retired when the generator fix is available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, yaml
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100