Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 10, 2025

Ticket: DX-1373

Enables individual descriptions for enum variants in OpenAPI output. Previously, enums generated from t.keyof() lost per-variant JSDoc comments during optimization.

Changes

  • knownImports.ts: Preserve property comments when generating keyof enum variants
  • optimize.ts: Skip consolidation for enum schemas with comments, maintaining oneOf structure
  • comments.test.ts: Add test validating individual enum variant descriptions

Example

export const TransactionRequestState = t.keyof({
  /** Transaction is waiting for approval from authorized users */
  pendingApproval: 1,
  /** Transaction was canceled by the user */
  canceled: 1,
});

Now generates OpenAPI with individual descriptions:

{
  "oneOf": [
    {
      "type": "string",
      "enum": ["pendingApproval"],
      "description": "Transaction is waiting for approval from authorized users"
    },
    {
      "type": "string",
      "enum": ["canceled"],
      "description": "Transaction was canceled by the user"
    }
  ]
}

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix enum description for API parameters fix: enable enum description for API parameters Nov 10, 2025
Copilot AI requested a review from koralkulacoglu November 10, 2025 16:55
Copilot finished work on behalf of koralkulacoglu November 10, 2025 16:55
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