Part of #22. Surfaced during review of #31.
Background
The file-based create path in several resource commands writes the raw API response to the exporter as json.RawMessage(body). When the user passes -o yaml, yaml.v3 encodes that []byte as an integer sequence instead of a YAML map. Two instances are already fixed:
Task
Audit every pkg/cmd/*/create/create.go (and any other action commands using the same exporter path) for the Write(json.RawMessage(body)) anti-pattern, decode the response into a typed struct / map[string]interface{} and pass the decoded value to the exporter.
Likely candidates to check (non-exhaustive):
pkg/cmd/route/create/create.go
pkg/cmd/service/create/create.go
pkg/cmd/consumer/create/create.go
pkg/cmd/ssl/create/create.go
pkg/cmd/credential/create/create.go
pkg/cmd/global-rule/create/create.go
pkg/cmd/secret/create/create.go
pkg/cmd/proto/create/create.go
pkg/cmd/plugin-metadata/create/create.go
- update/get/export paths in the same resources
For each instance fixed, add an E2E regression asserting -o yaml on the file-based path produces a valid YAML map (mirror TestPluginMetadata_GetYAML).
Part of #22. Surfaced during review of #31.
Background
The file-based create path in several resource commands writes the raw API response to the exporter as
json.RawMessage(body). When the user passes-o yaml,yaml.v3encodes that[]byteas an integer sequence instead of a YAML map. Two instances are already fixed:pkg/cmd/plugin-metadata/get/get.go— fixed in fix: resolve CLI bugs found during GA validation #31pkg/cmd/stream-route/create/create.go— pending fixup on fix: resolve CLI bugs found during GA validation #31Task
Audit every
pkg/cmd/*/create/create.go(and any other action commands using the same exporter path) for theWrite(json.RawMessage(body))anti-pattern, decode the response into a typed struct /map[string]interface{}and pass the decoded value to the exporter.Likely candidates to check (non-exhaustive):
pkg/cmd/route/create/create.gopkg/cmd/service/create/create.gopkg/cmd/consumer/create/create.gopkg/cmd/ssl/create/create.gopkg/cmd/credential/create/create.gopkg/cmd/global-rule/create/create.gopkg/cmd/secret/create/create.gopkg/cmd/proto/create/create.gopkg/cmd/plugin-metadata/create/create.goFor each instance fixed, add an E2E regression asserting
-o yamlon the file-based path produces a valid YAML map (mirrorTestPluginMetadata_GetYAML).