OpenAPITools / OpenAPITools/openapi-generator

Support for enum descriptions (x-enum-descriptions)

Open
#1,693 7 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature Feature: Enum
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

With https://github.com/OpenAPITools/openapi-generator/issues/893#issuecomment-416617460 we have introduced support for the x-enum-varnames extension.

In a similar way x-enum-descriptions should be supported:

  weather:
    type: object
    properties:
      type:
        type: integer
        format: int32
        enum:
          - 1
          - 2
          - 3
        x-enum-descriptions:
          - 'Blue sky'
          - 'Slightly overcast'
          - 'Take an umbrella with you'
        x-enum-varnames:
          - Sunny
          - Cloudy
          - Rainy

The java generator could add some Javadoc on top of the enum value.

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 reading the existing x-enum-varnames support referenced in the issue and locate how the Java generator renders enum values. Trace the generated Java enum output for the supplied OpenAPI example, then verify that x-enum-descriptions produces Javadoc for each value without changing generation when descriptions are absent.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.