Skip to content

Invalid items validation with @ArraySchema with implementation #4760

@istibekesi

Description

@istibekesi

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" ]
  }
}

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