Skip to content

fix(cli): fix AsyncAPI publish messages not generating send methods#12025

Open
fern-support wants to merge 3 commits intomainfrom
devin/1770070653-fix-asyncapi-publish-messages
Open

fix(cli): fix AsyncAPI publish messages not generating send methods#12025
fern-support wants to merge 3 commits intomainfrom
devin/1770070653-fix-asyncapi-publish-messages

Conversation

@fern-support
Copy link
Collaborator

@fern-support fern-support commented Feb 2, 2026

Description

Refs: Customer request from Immix

Link to Devin run: https://app.devin.ai/sessions/50ce682058004d24beb034e75ffe07d7
Requested by: @fern-support

Fixes an issue where AsyncAPI v2 publish operations (client-to-server messages) were not generating send methods in generated SDKs. The IR was only containing server-origin messages, causing websocket clients to be missing the ability to send subscription requests.

Changes Made

  • Modified ChannelConverter2_X.convertMessage() to pass the payload directly to SchemaOrReferenceConverter instead of resolving it first
  • Changed the condition from requiring schema != null to just checking if the converter output is non-null
  • Uses schemaOrReferenceConverterOutput.type directly instead of creating a new TypeReference from the converted schema
  • Removed unused TypeReference import
  • Added versions.yml entry (v3.56.10)
  • Updated AsyncAPI JSON refs test snapshots to reflect the fix

Root cause: When a message payload is a reference to an existing schema (e.g., $ref: "#/components/schemas/SubscribeRequest"), the SchemaOrReferenceConverter.maybeConvertReferenceObject returns output WITHOUT the schema property (only type and inlinedTypes). The original code required schema != null to proceed, which caused publish messages with schema references to be silently dropped.

Testing

  • Snapshot tests updated (asyncapi-json-refs-fdr.snap, asyncapi-json-refs-ir.snap)
  • Manual testing with Immix AsyncAPI spec

Human Review Checklist

  1. Verify publish operations specifically: The updated snapshots show subscribe (server→client) messages now being generated. Please verify that publish (client→server) operations also work correctly with the Immix AsyncAPI spec.
  2. Logic correctness: The converter's type property should be valid for both reference and inline schema cases
  3. Both branches affected: The change to the oneOf branch (which also had the schema != null check) is intentional - both branches now use the same pattern

The AsyncAPI v2 converter was not properly generating client-origin messages
(publish operations) because it required the SchemaOrReferenceConverter output
to have a non-null schema property. However, when the payload is a reference
to an existing schema, maybeConvertReferenceObject returns output WITHOUT the
schema property (only type and inlinedTypes).

This fix:
1. Passes the payload directly to SchemaOrReferenceConverter instead of
   resolving it first, allowing it to properly handle references
2. Uses schemaOrReferenceConverterOutput.type directly instead of requiring
   the schema property to be non-null
3. Removes the intermediate TypeReference creation since the converter
   already returns the correct type reference

Co-Authored-By: blank@buildwithfern.com <blank@buildwithfern.com>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

devin-ai-integration bot and others added 2 commits February 2, 2026 23:05
Co-Authored-By: blank@buildwithfern.com <blank@buildwithfern.com>
Co-Authored-By: blank@buildwithfern.com <blank@buildwithfern.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant