fix(cli): fix AsyncAPI publish messages not generating send methods#12025
Open
fern-support wants to merge 3 commits intomainfrom
Open
fix(cli): fix AsyncAPI publish messages not generating send methods#12025fern-support wants to merge 3 commits intomainfrom
fern-support wants to merge 3 commits intomainfrom
Conversation
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>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: blank@buildwithfern.com <blank@buildwithfern.com>
Co-Authored-By: blank@buildwithfern.com <blank@buildwithfern.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
ChannelConverter2_X.convertMessage()to pass the payload directly toSchemaOrReferenceConverterinstead of resolving it firstschema != nullto just checking if the converter output is non-nullschemaOrReferenceConverterOutput.typedirectly instead of creating a new TypeReference from the converted schemaTypeReferenceimportRoot cause: When a message payload is a reference to an existing schema (e.g.,
$ref: "#/components/schemas/SubscribeRequest"), theSchemaOrReferenceConverter.maybeConvertReferenceObjectreturns output WITHOUT theschemaproperty (onlytypeandinlinedTypes). The original code requiredschema != nullto proceed, which caused publish messages with schema references to be silently dropped.Testing
asyncapi-json-refs-fdr.snap,asyncapi-json-refs-ir.snap)Human Review Checklist
typeproperty should be valid for both reference and inline schema casesoneOfbranch (which also had theschema != nullcheck) is intentional - both branches now use the same pattern