Skip to content

Audit *create.go files for json.RawMessage exporter bug #32

@shreemaan-abhishek

Description

@shreemaan-abhishek

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).

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions