Skip to content

8.3.1: stream application/jsonl, and refuse the deprecated application/stream+json - #473

Merged
jemacineiras merged 2 commits into
sngular:mainfrom
joseegman-idoneea:feature/jsonl-streaming
Sep 29, 2026
Merged

jemacineiras merged 2 commits into
sngular:mainfrom
joseegman-idoneea:feature/jsonl-streaming

Conversation

@joseegman-idoneea

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #472: this commit reached its branch after it was merged, so 8.3.0 shipped without it.

application/jsonl streams like application/x-ndjson

OpenAPI 3.2 names JSON Lines as a sequential media type, and it is the same format as NDJSON. It now takes the same generated code:

  • Spring MVC servers get the endpoint/method pair, and NdjsonSupport.stream(...) sends the media type the contract declares instead of always application/x-ndjson.
  • WebFlux servers and reactive @HttpExchange interfaces use Flux<T>.
  • ApiWebClient registers application/jsonl in its Jackson codecs and as a streaming type of the encoder, so a Flux body is sent line by line, not as a JSON array.

Spring's own codecs stream application/x-ndjson only. For JSON Lines, a WebFlux server, or a reactive @HttpExchange backed by the application's WebClient.Builder, needs a CodecCustomizer. The README shows it for Boot 4 and for Boot 2/3.

application/stream+json fails the generation

8.3.0 treated it as a stream, but it is deprecated. Spring Framework 7 no longer streams it, and ApiWebClient's codecs, which list JSON and NDJSON only, would not read it. The generation now fails with a message asking for application/x-ndjson or application/jsonl.

Test plan

  • testNdjsonStreaming gains a JSON Lines response and body (/items/lines) in every variant; new error test for application/stream+json
  • Changed assets reviewed: the new operations, the media type argument of NdjsonSupport.stream, and the ApiWebClient (Boot 4) codecs
  • Engine: 256 tests green, checkstyle green; Maven plugin ITs green; Gradle test integrationTest green (JDK 21)
  • Runtime check outside the repo against Spring Boot 2.7.18, 3.5.8 and 4.0.8, over real HTTP; 23 tests green:
    • the MVC server sends Content-Type: application/jsonl lines and reads a JSON Lines body;
    • the generated WebClient client (2.7) receives and sends JSON Lines;
    • reactive @HttpExchange (4.0) does too with the README's CodecCustomizer, and fails with UnsupportedMediaTypeException without it.
  • Version bumped to 8.3.1 in all 5 places

🤖 Generated with Claude Code

joseegarcia and others added 2 commits September 29, 2026 15:59
…tream+json

JSON Lines is the same format as NDJSON, so it takes the same generated
endpoints, and NdjsonSupport now sends the media type the contract declares.
ApiWebClient registers it in its codecs and streams it; a WebFlux server or a
reactive @HttpExchange interface needs the application's codecs to, which the
README shows with a CodecCustomizer.

application/stream+json is deprecated and Spring Framework 7 no longer streams
it, and ApiWebClient's codecs would not read it: the generation now fails and
asks for application/x-ndjson or application/jsonl.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 5 complexity

Metric Results
Complexity 5

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@jemacineiras
jemacineiras merged commit 06be35e into sngular:main Sep 29, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request release Adding this tag to a PR will cause a release on merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants