swagger-api / swagger-api/swagger-core

swagger-annotations: Add annotations to support x-enum-descriptions and x-enum-varnames

Open
#4,844 0 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backlog
Dominant language
Java
Stars
7.5k
Forks
2.3k
Avg merge
18h 1m
Merged PRs (30d)
10

Description

Add annotations to support x-enum-descriptions and x-enum-varnames.

More information here: https://openapi-generator.tech/docs/templating/#enum

Example
This java code:

public enum SignType {
        SIGNTYPE_PADES("PAdES"),
        SIGNTYPE_XADES("XAdES"),
        SIGNTYPE_CADES("CAdES");
        
        public final String value;
        
        SignType(String value){
            this.value = value;
        }
        
        @Override
        public String toString() {
          return String.valueOf(value);
         }
    }

Generates an openapi.json like this:

"schema" : {
                  "type" : "string",
                  "enum" : [ "PAdES", "XAdES", "CAdES" ]
                }

And Client generation produces:

public enum SignType {
        PAD_ES("PAdES"),
        XAD_ES("XAdES"),
        CAD_ES("CAdES");

}

But I needs anything like this:

public enum SignType {
        /**  Signtype PAdES */
        SIGNTYPE_PADES("PAdES"),
        /**  Signtype XAdES */
        SIGNTYPE_XADES("XAdES"),
        /**  Signtype CAdES */
        SIGNTYPE_CADES("CAdES");
...
}

I need annotations to generate x-enum-descriptions and x-enum-varnames in openapi.json file

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 swagger-annotations enum annotation handling and review the linked OpenAPI Generator enum templating documentation. Define how annotations should represent x-enum-descriptions and x-enum-varnames, then verify the shown SignType example produces the requested OpenAPI metadata and generated enum comments.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.