-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
priority: highHigh priorityHigh prioritystatus: pr submittedA pull request has been submitted for the issueA pull request has been submitted for the issuetype: regressionA breaking change was introduced in a minor or patch releaseA breaking change was introduced in a minor or patch release
Milestone
Description
The annotation io.swagger.v3.oas.annotations.media.Schema used on an enum class is throwing the error "Enum types cannot be defined as beans" since Micronaut 2.5.6.
Steps to Reproduce
- Having an enum class
@Schema(description = "My description")
public enum MyEnumClass {
VALUE1,
VALUE2;
}
- Having a class using the enum
public class MyClass {
MyEnumClass logisticType;
}
Expected Behaviour
Build successful.
Actual Behaviour
The error "Enum types cannot be defined as beans" is thrown.
That error handling was added longtime ago on this commit: 88e5f1f#diff-eb053b86bf8cb1bf2922f4e33f58ffdd98065386b02f884b32b70afa5b4ace42
Environment Information
- Operating System: Mac OS Big Sur
- Micronaut Version: 2.5.6
- JDK Version: JDK 16
Workaround solution
@ApiModel(description = "My description")
public enum MyEnumClass {
VALUE1,
VALUE2;
}
public class MyClass {
@ApiModelProperty MyEnumClass logisticType;
}
Metadata
Metadata
Assignees
Labels
priority: highHigh priorityHigh prioritystatus: pr submittedA pull request has been submitted for the issueA pull request has been submitted for the issuetype: regressionA breaking change was introduced in a minor or patch releaseA breaking change was introduced in a minor or patch release