'Specifying maxItems for a List<List<Object>> using spring swagger.v3 ArraySchema annotation

We are facing an issue where we are unable to use any variant of @ArraySchema to specify the limit of maxItems for the properties such as -

List<List< obj >> test;

List<List<List< obj >>>> listOfTest;

JSON Validation error:

Semantic error at test.items Arrays must have 'maxItems' property defined

Semantic error at listOfTest.items.items Arrays must have 'maxItems' property defined

Tried following -

@ArraySchema(schema = @ArraySchema(schema =@Schema(description = "test), maxItems =2))

@ArraySchema(arraySchema = @ArraySchema(schema =@Schema(description = "test), maxItems =2))

@ArraySchema(arraySchema = @Schema(//with type property)

But all the above flavors fail due to incompatibility error.

Incompatible Types : Found: ArraySchema, required: Schema

Project is using springdoc openapi version 1.6.5

Can someone please specify how to resolve this issue?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source