Redocly / Redocly/redoc

Suggestion: Support x-enumNames extension

Open
#234 2 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Enhancement
Dominant language
TypeScript
Stars
25.9k
Forks
2.4k
Avg merge
13h 10m
Merged PRs (30d)
4

Description

The x-enumNames extension (generated by NSwagStudio in our case) includes the human readable name of an enum when you're using integers for enum rather than strings
It would be great if ReDoc could support being able to display what the integer element of an enum value means, rather than just the value

Currently it shows as
Valid values: 0 1 2

Showing something like
Valid values: Female (0) Male (1) Other (2)
would be really useful

   "PersonGender": {
      "type": "integer",
      "x-enumNames": [
        "Female",
        "Male",
        "Other"
      ],
      "enum": [
        0,
        1,
        2
      ],
      "description": ""
    },

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the ReDoc schema-rendering path that produces the current “Valid values” output for integer enums. Use the provided PersonGender example to verify how x-enumNames aligns with enum values, and consider the work complete when the display shows names with their numeric values while preserving existing behavior when the extension is absent.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
documentation
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.