Skip to content

fix(openapi): avoid OAuth scope type collisions - #17412

Draft
ngyna wants to merge 3 commits into
fern-api:mainfrom
ngyna:anguyen-fern-oauth-scope-collision
Draft

fix(openapi): avoid OAuth scope type collisions#17412
ngyna wants to merge 3 commits into
fern-api:mainfrom
ngyna:anguyen-fern-oauth-scope-collision

Conversation

@ngyna

@ngyna ngyna commented Aug 14, 2026

Copy link
Copy Markdown

Closes #17411. The OpenAPI importer now preserves a user-defined OAuthScope instead of letting Fern's synthetic OauthScope enum converge on the same generated file path.

  • Defer the synthetic enum until all definitions are emitted, then deconflict its name against the actual root-package types.
  • Keep OauthScope for unaffected APIs and choose a deterministic OauthAuthorizationScope fallback only on a genuine case-insensitive collision.
  • Cover component, inline-generated, and webhook-response collisions while preserving existing grouped, unreferenced, and request-inline behavior.

@nitpickybot nitpickybot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review Summary

Adds collision-avoidance for the synthetic OauthScope enum in the OpenAPI importer, plus a fixture and snapshots. The core logic is straightforward, but the collision scan is both too coarse (ignores groupName, so it renames even when the colliding schema lands in a different file) and too narrow (ignores namespaced schemas), and getSchemaName can return undefined for schema variants without a generated name, which would blow up on .toLowerCase().

  • 🟡 2 warning(s)
  • 🔵 2 suggestion(s)

Comment thread packages/cli/api-importers/openapi/openapi-ir-to-fern/src/buildAuthSchemes.ts Outdated
Comment thread packages/cli/api-importers/openapi/openapi-ir-to-fern/src/buildAuthSchemes.ts Outdated
Comment thread packages/cli/api-importers/openapi/openapi-ir-to-fern/src/buildAuthSchemes.ts Outdated
Comment thread packages/cli/api-importers/openapi/openapi-ir-to-fern/src/buildAuthSchemes.ts Outdated

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 1 additional finding in Devin Review.

Open in Devin Review

Comment thread packages/cli/api-importers/openapi/openapi-ir-to-fern/src/buildAuthSchemes.ts Outdated
@ngyna
ngyna force-pushed the anguyen-fern-oauth-scope-collision branch 2 times, most recently from f657318 to 309a8a4 Compare August 14, 2026 04:38
@ngyna
ngyna force-pushed the anguyen-fern-oauth-scope-collision branch from 309a8a4 to a910009 Compare August 14, 2026 04:44
@ngyna
ngyna marked this pull request as draft August 14, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenAPI OAuth scope enum collides with OAuthScope components

1 participant