kokuwaio / micronaut-openapi-codegen

OpenAPI codegen for Micronaut
Apache License 2.0
39 stars 16 forks source link

Enums generated without @Serdable annotations #407

Open alButusov opened 3 weeks ago

alButusov commented 3 weeks ago

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 1 week ago

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