fix(cli): prevent AsyncAPI channel name collisions when merging multiple specs#12325
Closed
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Closed
fix(cli): prevent AsyncAPI channel name collisions when merging multiple specs#12325devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Conversation
…ple specs Co-Authored-By: will.kendall@buildwithfern.com <wpk235@gmail.com>
Contributor
Author
🤖 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:
|
Contributor
|
This PR is stale because it has been open 25 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
Contributor
|
This PR was closed because it has been inactive for 5 days after being marked stale. |
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 issue where Lightning v2 WebSocket endpoint was missing from docs when two AsyncAPI specs with the same
x-fern-sdk-group-name(e.g., both "Text to Speech") were included in one API definition.When multiple AsyncAPI specs produce the same channel ID (derived from
x-fern-sdk-group-name), the spread merge{...channels1, ...channels2}silently overwrites the first channel. This PR adds collision detection with suffix-based deconfliction (_1,_2, etc.) across all three merge paths.Link to Devin run | Requested by @willkendall01
Changes Made
openapi-ir-parser/src/parse.ts: Replaced spread merges with a newmergeChannels()helper that detects ID collisions and appends numeric suffixes. Applied in the inline AsyncAPI parse loop and all 3 return paths of themerge()function.v3-importer-commons/AbstractSpecConverter.ts: InaddWebsocketChannelToIr, detect when the computedchannelNamealready exists inthis.ir.websocketChannels. On collision, fall back to the path-based default name with a suffix. Also reassigns the package if the existing package already has a different websocket channel.ir-utils/mergeIntermediateRepresentation.ts: InmergeServicesAndChannels, iterate ir2 channels with collision detection instead of spread-merging. Tracks renamed channel IDs and updates subpackage/rootPackage.websocketreferences to point to the new IDs.cli/versions.yml: Added 3.76.1 changelog entry.Testing
x-fern-sdk-group-nameshould be added.ir2inmergeIntermediateRepresentation.ts(lines 410-418): Subpackage and rootPackage.websocketreferences are mutated in place onir2. Verifyir2is not referenced after the merge call.parse.tsmergeChannelsdoes not update group/package references: Unlike the IR merge which updates subpackage refs, the OpenAPI IR merge only renames the channel key. Confirm that nothing in the OpenAPI IR layer references channels by ID downstream.AbstractSpecConverter.ts: On collision, a new package is created from[defaultChannelName]. Verify this produces correct docs navigation for the colliding channel.