Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
anadal-fundaciobit opened this issue Feb 19, 2025 · 0 comments

Comments

@anadal-fundaciobit
Copy link

anadal-fundaciobit commented Feb 19, 2025

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

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

No branches or pull requests

1 participant