Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions fern/products/sdks/overview/java/changelog/2026-03-20.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## 4.0.3
**`(fix):`** Fix WebSocket `handleIncomingMessage()` using Fern-internal message IDs
(e.g. `AgentV1Welcome`, `ListenV1Results`) instead of the wire discriminant
values from the spec (e.g. `Welcome`, `Results`). This caused all incoming
message handlers to never fire, falling through to the unknown type handler.

The generator now extracts wire discriminant values from each message body's
`type` property — resolving literal values (e.g. `literal<"Welcome">`) and
enum values (e.g. `enum[Flushed, Cleared]`) — and dispatches via a `switch`
statement on those values. This aligns with the approach used by the Python
generator.


**`(fix):`** WebSocket handler registration methods and field names now use
wire discriminant values instead of Fern-internal prefixed names. For example,
`onAgentV1Welcome(handler)` is now `onWelcome(handler)`, and
`onAgentV1PromptUpdated(handler)` is now `onPromptUpdated(handler)`. Methods
that were already backed by a custom `x-fern-sdk-method-name` (e.g.
`onFunctionCallResponse`) are unchanged.


**`(chore):`** Improve generated WebSocket client code quality: use a string literal for
static URL paths instead of `StringBuilder`, remove dead if/else branches in
async `sendMessage()`, consolidate redundant catch blocks in message dispatch,
and correct Javadoc articles ("a" vs "an") for type names starting with vowels.


Loading