Skip to content

Conversation

@stephencme
Copy link
Contributor

@stephencme stephencme commented Jan 22, 2026

Description

Refs fern-api/fern-platform#6417

Fixes an issue where undiscriminated union variants in the API explorer displayed long generated schema names from OpenAPI (e.g., "ObjectsObjectTypeBatchUpsertPostRequestBodyContentApplicationJsonSchemaRecordsItems0") instead of user-friendly type names.

Why Undiscriminated Unions Only?

This fix targets undiscriminated unions specifically because of how displayName is populated differently for each union type:

  • Discriminated unions: displayName: variant.displayName — comes directly from the IR's variant.displayName, which is only set when the user specifies display-name in their Fern definition. No fallback to originalName.
  • Undiscriminated unions: displayName: variant.type.displayName ?? variant.type.name.originalName — had a fallback to originalName, which for OpenAPI-sourced APIs could be long generated schema names.

Discriminated unions are unaffected because they never had the problematic fallback behavior.

Changes Made

  • Modified convertTypeShape.ts to only use displayName when explicitly specified via display-name in the Fern definition
  • Removed the fallback to variant.type.name.originalName which was populating displayName with generated OpenAPI schema names
  • Updated test snapshots to reflect the new behavior (displayName is now undefined for variants without user-specified names)
  • Bumped CLI version to 3.49.2

Testing

Human Review Checklist


Link to Devin run: https://app.devin.ai/sessions/33185c45a6d34c6ba1a2d93478e98567
Requested by: @stephencme

devin-ai-integration bot and others added 2 commits January 22, 2026 19:38
…ion variants

Remove fallback to originalName for undiscriminated union variant displayName.
This prevents generated schema names from OpenAPI (e.g., 'ObjectsObjectTypeBatchUpsertPostRequestBody...')
from being used as displayName, which results in poor UX in the API explorer.

Now displayName is only set when the user explicitly specifies display-name in their Fern definition.

Co-Authored-By: stephen@buildwithfern.com <hello@stephenc.me>
Co-Authored-By: stephen@buildwithfern.com <hello@stephenc.me>
@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

…undiscriminated-union-displayname

Co-Authored-By: stephen@buildwithfern.com <hello@stephenc.me>
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.

2 participants