Skip to content

fix(output): project the rows of a single --page, not its envelope - #454

Merged
neilmartin83 merged 1 commit into
mainfrom
fix/page-select-projection
Oct 29, 2026
Merged

neilmartin83 merged 1 commit into
mainfrom
fix/page-select-projection

Conversation

@neilmartin83

Copy link
Copy Markdown
Member

Stacked on #453.

Problem

--page answers {results, totalCount}, so --select and --field projected the envelope's own two keys:

$ jamf-cli pro categories list --page 0 --page-size 2 --select id -o json
{}
$ jamf-cli pro categories list --page 0 --page-size 2 --field id
--field id matched no field in 1 row(s)

Both exit 0. Without --page, the same flags project each row.

Change

output.UnwrapPage reads the rows of a single page when a projection (--select, --compact) or --field is set, the way --all already does. Both totalCount and results must be present, so a record that merely carries a results field is left alone. The unwrapped output no longer carries totalCount.

Verification

  • go test ./..., golangci-lint run, gofumpt clean.
  • Live on platform-nmartin and pro-nmartin: --page 0 --page-size 2 --select id returns ids 64 and 46 in json and csv, and --field id prints them.

🤖 Generated with Claude Code

@neilmartin83
neilmartin83 added this pull request to stack #456 October 25, 2026 07:39
Base automatically changed from fix/terminal-escape-sanitize to main October 26, 2026 22:43
@ktn-jamf
ktn-jamf force-pushed the fix/page-select-projection branch from 70187e9 to 8b0d186 Compare October 26, 2026 22:43
--page answers {results, totalCount}, so --select and --field projected the
envelope's own two keys: --select id printed {} and --field id matched
nothing, both at exit 0. UnwrapPage reads the rows when a projection is set,
as --all already does. Both keys are required so a record that carries a
results field is left alone.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@neilmartin83
neilmartin83 force-pushed the fix/page-select-projection branch from 8b0d186 to b7d633b Compare October 28, 2026 18:17
@neilmartin83
neilmartin83 merged commit 0b2bfd8 into main Oct 29, 2026
5 checks passed
@neilmartin83
neilmartin83 deleted the fix/page-select-projection branch October 29, 2026 16:41
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.

2 participants