Skip to content

feat: support gron output formatting - #546

Open
michaeladler wants to merge 1 commit into
siemens:mainfrom
michaeladler:feat/gron
Open

michaeladler wants to merge 1 commit into
siemens:mainfrom
michaeladler:feat/gron

Conversation

@michaeladler

@michaeladler michaeladler commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Description

Support application/gron content negotiation for standard requests.
For SSE streams (text/event-stream), support gron formatting per event payload via wfxctl job events --format gron.

This simplifies shell script filtering by eliminating the need to parse JSON.

Issues Addressed

List and link all the issues addressed by this PR.

Change Type

Please select the relevant options:

  • Bug fix (non-breaking change that resolves an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • I have read the CONTRIBUTING document.
  • My changes adhere to the established code style, patterns, and best practices.
  • I have added tests that demonstrate the effectiveness of my changes.
  • I have updated the documentation accordingly (if applicable).
  • I have added an entry in the CHANGELOG to document my changes (if applicable).

@michaeladler
michaeladler requested a review from stormc as a code owner October 1, 2026 07:07
@codecov

codecov Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.76923% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.34%. Comparing base (59556ff) to head (9976398).

Files with missing lines Patch % Lines
internal/gron/gron.go 81.48% 20 Missing ⚠️
internal/gron/middleware.go 76.54% 19 Missing ⚠️
cmd/wfxctl/flags/basecmd.go 78.57% 6 Missing ⚠️
cmd/wfxctl/cmd/health/health.go 76.92% 3 Missing ⚠️
internal/gron/encode.go 75.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #546      +/-   ##
==========================================
- Coverage   82.43%   82.34%   -0.10%     
==========================================
  Files         100      103       +3     
  Lines        3878     4130     +252     
==========================================
+ Hits         3197     3401     +204     
- Misses        680      728      +48     
  Partials        1        1              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@michaeladler
michaeladler force-pushed the feat/gron branch 2 times, most recently from 854fde0 to ada553b Compare October 1, 2026 07:21
contentType, _, _ := mime.ParseMediaType(resp.Header.Get("Content-Type"))
if strings.EqualFold(contentType, "application/gron") {
if b.Filter != "" {
return fault.New("cannot apply filter to application/gron response")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hm, why can't we? It's just serialized JSON explicitly spelling out the path in every line. So, technically, we can do filtering before doing that?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Well we could, but then we would have to first decode the response into JSON, run the jq-filter against it and then encode again to gron. Worth it? Currently we have not vendored the unmarshalling from gron.

Comment thread internal/gron/gron.go
Support 'application/gron' content negotiation for standard requests.
For SSE streams ('text/event-stream'), support gron formatting per event
payload via 'wfxctl job events --format gron'.

This simplifies shell script filtering by eliminating the need to parse
JSON.

Signed-off-by: Michael Adler <michael.adler@siemens.com>

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.

2 participants