Skip to content

Conversation

@koralkulacoglu
Copy link

Ticket: DX-1373

@koralkulacoglu koralkulacoglu requested a review from a team as a code owner November 6, 2025 16:03
@koralkulacoglu koralkulacoglu marked this pull request as draft November 6, 2025 19:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for preserving individual enum variant descriptions when generating OpenAPI specifications. The implementation ensures that when enums have JSDoc comments on individual properties, these descriptions are maintained in the generated oneOf schemas rather than being consolidated.

  • Preserves per-variant comments in keyof-based enums through the IR
  • Prevents consolidation of enum values that have individual descriptions
  • Extracts enum descriptions from array items to parameter level when appropriate

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
packages/openapi-generator/test/openapi/comments.test.ts Adds two test cases verifying enum description preservation: one with individual variant descriptions (oneOf) and one with a single enum description
packages/openapi-generator/src/knownImports.ts Updates keyof handler to preserve comments from object properties when creating enum schemas
packages/openapi-generator/src/optimize.ts Modifies simplifyUnion to skip consolidation of enum literals that have associated comments
packages/openapi-generator/src/openapi.ts Adds logic to extract descriptions from array items and move them to the parameter level for better API documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@koralkulacoglu koralkulacoglu marked this pull request as ready for review November 12, 2025 18:59
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.

2 participants