swagger-core
swagger-core copied to clipboard
Invalid items validation with @ArraySchema with implementation
Describe the bug
Using @ArraySchema annotation on a field with implementation parameter generates invalid openapi schema.
To Reproduce
public enum MyEnum {
red,
green
}
public enum MyOtherEnum {
green,
blue
}
@ArraySchema(schema = @Schema(implementation = MyOtherEnum.class))
@Size(min = 1, max = 3)
private List<MyEnum> setOfEnums;
Generated result:
"setOfEnums" : {
"maxItems" : 3,
"minItems" : 1,
"type" : "array",
"items" : {
"maxLength" : 3,
"minLength" : 1,
"type" : "string",
"enum" : [ "green", "blue" ]
}
}
Expected behavior
"setOfEnums" : {
"maxItems" : 3,
"minItems" : 1,
"type" : "array",
"items" : {
"type" : "string",
"enum" : [ "green", "blue" ]
}
}