Enums generated without @Serdable annotations #407

Closed
opened 2024-08-26 15:43:05 +02:00 by alButusov · 2 comments
alButusov commented 2024-08-26 15:43:05 +02:00 (Migrated from github.com)

Hi!
I am using the generator version 4.2.0 and faced the following problem:
Enum classes are generated without the @Serdable annotation, which is why the Jackson annotations (@JsonCreator and @JsonValue) do not work.

This is a known problem - https://github.com/micronaut-projects/micronaut-serialization/issues/780.
As a solution, it is recommended to add the @Serdable annotation, but I did not find such an opportunity in the generator configuration and in the modelEnum.mustache file.

To illustrate, I made an example with tests - github.com/alButusov/micronaut-openapi-codegen@30bffacea3 (simple example from https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/ for allOff).

Does this require a modification of the generator or am I doing something wrong?

Hi! I am using the generator version 4.2.0 and faced the following problem: Enum classes are generated without the @Serdable annotation, which is why the Jackson annotations (@JsonCreator and @JsonValue) do not work. This is a known problem - https://github.com/micronaut-projects/micronaut-serialization/issues/780. As a solution, it is recommended to add the @Serdable annotation, but I did not find such an opportunity in the generator configuration and in the modelEnum.mustache file. To illustrate, I made an example with tests - https://github.com/alButusov/micronaut-openapi-codegen/commit/30bffacea388b9d57d972fbf9b60c47508b4bc5e (simple example from https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/ for allOff). Does this require a modification of the generator or am I doing something wrong?
sschnabe commented 2024-09-10 14:26:02 +02:00 (Migrated from github.com)

Hi @alButusov , thanks for this issue. This was a bug, can you check #411 ? If this pr fixes yoor issue i will create a release. br

Hi @alButusov , thanks for this issue. This was a bug, can you check #411 ? If this pr fixes yoor issue i will create a release. br
sschnabe commented 2024-09-18 20:28:54 +02:00 (Migrated from github.com)

see 4.3.1

see [4.3.1](https://github.com/kokuwaio/micronaut-openapi-codegen/releases/tag/4.3.1)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
kokuwaio/micronaut-openapi-codegen#407
No description provided.