79620984

Date: 2025-05-14 08:02:16
Score: 2
Natty:
Report link

Reason for issue :
You tried to use @ApiModelProperty directly on enum constants, but this doesn't work because swaggar (springfor or springdoc that generate docs) only look at annotations on Classes, Fields, Methods. They don't read annotations placed on individual enum values like (TYPE_A, TYPE_B).
enum constants (TYPE_A, TYPE_B) are not fields or methods - they are just static final objects. Swagger doesn't know to look there.
Solutions :
1.
Add @schema to Enum (this is works for OpenApi 3.0 annotation, many swagger UI generators (Springfox) ignores @schema enum values.
2. Use ModelConverter (OpenApi) to define a enum description.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • User mentioned (1): @ApiModelProperty
  • User mentioned (0): @schema
  • User mentioned (0): @schema
  • Low reputation (1):
Posted by: Magesh Priya