fix(openapi): webhook audience filtering in OpenAPI v3 importer #11559
+7,110
−1
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
Fixes an issue where webhooks with
x-fern-audienceswere not showing up in docs when generating for matching audiences.Requested by Catherine Deskur
Changes Made
filterIrForAudiencesmethod inAbstractSpecConverter.tsto correctly filter individual webhooks within each group, rather than filtering entire webhook groups by their group IDwebhook-audiencetest fixture to verify webhooks withx-fern-audiencesare correctly parsed and processedwebhook-audienceto Ruby SDKallowedFailures(Ruby SDK uses IR v61 which doesn't support the newer IR format)Root Cause
The original code was comparing webhook group IDs (the map keys in
ir.webhookGroups) against individual webhook IDs (stored infilteredWebhooks). These are different values, so the filter would never match, causing all webhooks with audiences to be filtered out.The Fix
Changed from filtering groups by group ID:
To filtering individual webhooks within each group:
This aligns with the correct implementation in
filterIntermediateRepresentationForAudiences.ts(lines 52-70).Testing
webhook-audiencetest fixture with webhooks usingx-fern-audiences(public, private, and no audience)Human Review Checklist
packages/commons/ir-utils/src/filtered-ir/filterIntermediateRepresentationForAudiences.tsaudiences: { type: "all" }, so the filtering code path itself isn't directly exercised by the fixtureLink to Devin run