I'm having a hard time generating proper swagger 2.0 yaml documentation using kongchen swagger-maven-plugin. My problem happens when have 2 classes using same enum class.
public enum Enum {
A,B,C
}
public class First {
public Enum e;
}
public class Second {
public Enum e;
}
This will generate swagger.yaml file containing:
definitions:
First:
type: "object"
properties:
e:
type: "string"
enum:
- "A"
- "B"
- "C"
Second:
type: "object"
properties:
e:
type: "string"
enum:
- "A"
- "B"
- "C"
However, I would like it to generate just one enum model definition and reference the type in objects' fields. Something like this:
definitions:
First:
type: "object"
properties:
$ref: "#/definitions/Enum"
Second:
type: "object"
properties:
e:
$ref: "#/definitions/Enum"
Enum:
type: "string"
enum:
- "A"
- "B"
- "C"
Is there any way to achieve this? This way my generated client generates multiple inner enum classes with same values.