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

Invalid items validation with @ArraySchema with implementation #4760

Open
istibekesi opened this issue Oct 16, 2024 · 0 comments
Open

Invalid items validation with @ArraySchema with implementation #4760

istibekesi opened this issue Oct 16, 2024 · 0 comments

Comments

@istibekesi
Copy link

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