Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@raphael
Copy link
Member

@raphael raphael commented Oct 16, 2025

This PR refines SSE server generation to format event data more accurately and efficiently.

  • Add to SSE data to determine when to build the event payload from the generated HTTP response body type.
  • Use the generated response body () for SSE payloads when present, ensuring parity with normal HTTP responses.
  • Encode primitives directly (string/bytes/bool/numbers), fall back to only for complex values.
  • Expose to the SSE template funcs.
  • Update SSE golden files accordingly.

Rationale:

  • Aligns SSE data shape with existing response body converters, avoiding divergence between streaming and non-streaming endpoints.
  • Avoids unnecessary JSON for primitives, improving readability and performance for clients.

Tests:

  • ok goa.design/goa/v3/http/codegen 1.145s passes locally; goldens updated.

…ive-friendly encoding

- Add SSE.HasResponseBody flag computed from result responses

- Use generated ResponseBody for SSE payload when present

- Inline primitive formatting; JSON-marshal only for complex types

- Expose goify to server_sse template funcs

- Update SSE golden files to reflect new behavior

Rationale:

- Streams match response body shape and avoid unnecessary JSON for primitives.
@raphael raphael enabled auto-merge (squash) October 16, 2025 18:17
@raphael raphael merged commit 0bc1db5 into v3 Oct 16, 2025
7 checks passed
@raphael raphael deleted the http/sse-payload-body-formatting branch October 16, 2025 18:18
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.

1 participant