Skip to content

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

Open
@anadal-fundaciobit

Description

@anadal-fundaciobit

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions