Skip to content

Fix webhook create/list output to use protojson#4592

Merged
nikohofmann merged 3 commits into
mainfrom
fix/webhook-protojson-output
Jun 22, 2026
Merged

Fix webhook create/list output to use protojson#4592
nikohofmann merged 3 commits into
mainfrom
fix/webhook-protojson-output

Conversation

@nikohofmann

Copy link
Copy Markdown
Contributor

Fix buf beta registry webhook create and buf beta registry webhook list printing empty objects ({} / [{}]) instead of actual webhook data.

Root cause: both commands used encoding/json to marshal proto-generated structs. Proto structs store field data in unexported fields, invisible to encoding/json, so all fields silently serialize as zero values. Fix is to replace encoding/json.MarshalIndent with protojson.MarshalOptions{Multiline: true, Indent: "\t"}.Marshal, which uses the protobuf reflection API and correctly reads proto field values.

Note: the create output shape changes from a bare {...} to {"webhook": {...}} to match the RPC response structure.

@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJun 22, 2026, 4:19 PM

The repo lint rule forbids direct protojson.MarshalOptions use;
private/pkg/protoencoding is the sanctioned wrapper.

@doriable doriable left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you for putting this up! We also chatted about testing out this fix etc.

Stamping ahead of time, but do you mind adding a changelog statement for this, since this fixes a user-facing issue with webhooks? Thank you!

@doriable doriable changed the title Fix: use protojson for webhook create/list output Fix webhook create/list output to use protojson Jun 22, 2026
@nikohofmann nikohofmann merged commit f0f8156 into main Jun 22, 2026
11 checks passed
@nikohofmann nikohofmann deleted the fix/webhook-protojson-output branch June 22, 2026 16:50
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