Skip to content

Generate consistent JSON between get and list commands - #116

Merged
jeri-temporal merged 1 commit into
mainfrom
jeri/json-consistency
Sep 29, 2026
Merged

jeri-temporal merged 1 commit into
mainfrom
jeri/json-consistency

Conversation

@jeri-temporal

Copy link
Copy Markdown
Contributor

Get commands just print the resulting protojson, whereas list commands wrap a list of protos in a struct providing additional context. When that struct is rendered as JSON, the protos within get handled as regular structs. Using jsonv2 allows us to set a custom marshaller that delegates proto messages to protojson

What was changed

Switch to jsonv2 in the printer+ add a custom marshaller for protos. This serializes protos the same whether they're nested or not.

Why?

Consistency between list and get commands when printing the same protos

Checklist

  1. Closes [Bug] List/Get API keys have different outputs cli#1200

  2. How was this tested:
    make test, verified no diff between the output of ./temporal-cloud apikey list -o json | jq '.ApiKeys[0]' and ./temporal-cloud apikey get --key-id <ID from list output>

Get commands just print the resulting protojson, whereas list commands
wrap a list of protos in a struct providing additional context. When
that struct is rendered as JSON, the protos within get handled as
regular structs. Using jsonv2 allows us to set a custom marshaller that
delegates proto messages to protojson
@jeri-temporal
jeri-temporal merged commit 58d903c into main Sep 29, 2026
7 checks passed
@jeri-temporal
jeri-temporal deleted the jeri/json-consistency branch September 29, 2026 17:47

This branch was successfully deployed

1 active deployment
integration — a960f776 Deployed Sep 28, 2026 by jeri-temporal via Integration tests #31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] List/Get API keys have different outputs

2 participants