I have multiple request bodies that need to utilize the same enums, but am struggling to reference a single definition across multiple schemas.
Within my openapi.yaml
file, I have included:
components:
schemas:
Widget:
type: string
enum:
- THING
In the body definitions that I have for my POST/PUT requests, I include:
widget:
schema:
$ref: '#/../openapi.yaml/components/schemas/Widget'
description: Include Widgets in your API today!
but in the generated-code, what is being created is:
@JsonProperty("widget")
private Object widget; // expecting: `private Widget widget;`
while a separate class is created with:
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public enum Widget {
WIDGET("WIDGET"),
private String value;
Association(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
...
How can I create a reference to enum definitions across files?