Forum Discussion

Techtez's avatar
Techtez
Occasional Contributor
2 months ago

Swagger Annotation does not take dynamic value.

Hi, 

Our project requires value in the annotation @Schema at the runtime but swagger does not provide that feature, but when we try to give the value through an variable it give error "annotation value should be constant expression".
Can someone help us determine if there is a way to set the value of the description property in Swagger's @Schema annotation at runtime?

for example ,
@Schema(description = "List of numbers \n\n example = {20240103144205,20240103144206}, Maximum allowed: "+ maxItems  )
    private List<Number> numberList = new ArrayList<Number>();

No RepliesBe the first to reply