swagger-core icon indicating copy to clipboard operation
swagger-core copied to clipboard

ArraySchema annotation on model accessors doesn't map to API spec properly

Open MichailLogin opened this issue 3 years ago • 1 comments

Help me, what am I doing wrong?

@ArraySchema(maxItems = 500, arraySchema = @Schema(description = "error", type = "string", maxLength = 2048)) private List errors;

Result: "errors": { "maxLength": 2048, "maxItems": 500, "type": "array", "description": "Error", "items": { "type": "string" } } expected: "errors": { "maxItems": 500, "type": "array", "description": "Error", "items": { "type": "string", "maxLength": 2048 } }

MichailLogin avatar Dec 11 '22 09:12 MichailLogin

It helped me to: @ArraySchema(maxItems = 500, arraySchema = @Schema(description = "Errors"), schema = @Schema(type = "string", maxLength = 2048)) Result: "errors": { "maxItems": 500, "type": "array", "description": "Errors", "items": { "maxLength": 2048, "type": "string" } }

MichailLogin avatar Dec 12 '22 04:12 MichailLogin