Skip to content

CLI: Fix --output=json list-refs emitting one object per retention property - #4101

Open
tomron wants to merge 1 commit into
apache:mainfrom
tomron:fix/json-output-list-refs
Open

tomron wants to merge 1 commit into
apache:mainfrom
tomron:fix/json-output-list-refs

Conversation

@tomron

@tomron tomron commented Oct 13, 2026

Copy link
Copy Markdown

Closes #4098

Rationale for this change

JsonOutput.describe_refs() emitted one JSON object per retention property instead of one per snapshot reference, so pyiceberg --output=json list-refs could return three objects for a table with a single ref. This merges the retention properties into a single object per reference, consistent with ConsoleOutput, which renders one row per reference.

Are these changes tested?

Yes. Two new regression tests in tests/cli/test_output.py: one ref with multiple retention properties, and multiple refs including one with no retention properties. Both fail without the fix; the full tests/cli/ suite (103 tests) passes.

Are there any user-facing changes?

Yes. The JSON output of list-refs changes shape: one object per ref instead of one object per retention property. This matches the expected output described in #4098.


AI disclosure: this PR was prepared with AI assistance; the commit carries a Generated-by note in line with the ASF guidance on generated contributions.

…operty

JsonOutput.describe_refs() emitted a separate JSON object for every
retention property of a snapshot reference. Merge the retention
properties into a single object per reference, consistent with
ConsoleOutput which renders one row per reference.

Add regression tests covering a single reference with multiple
retention properties and multiple references.

Generated-by: Instinct (AI-assisted)

Closes apache#4098

This branch has not been deployed

No deployments
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.

CLI: --output=json list-refs emits one object per retention property instead of per ref

1 participant