Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Micronaut OpenAPI Generator (still) generates classes that can't build for models with two (or more) levels of inheritance and a discriminator #1315

Closed
runenielsen opened this issue Nov 22, 2023 · 7 comments · Fixed by #1343

Comments

@runenielsen
Copy link

runenielsen commented Nov 22, 2023

Expected Behavior

The error originally reported in this closed issue is unfortunately not fixed, even if a change was made in that issue, and it still does not work in version 4.2.0. See the original issue for description.

Actual Behaviour

See the original issue for description.

In addition the DetailedBookInfo classes still has TypeEnum type as a constructor parameter. This was supposed to have been removed in this issue. Note the TypeEnum type constructor parameter has been removed in the two super classes (as expected).

Steps To Reproduce

See the original issue.

Environment Information

  • macOS
  • JDK 17

Example Application

https://github.com/runenielsen/discriminatorconstructorbug (I upgraded it to use Micronaut 4.2.0)

Version

4.2.0

@runenielsen runenielsen changed the title OpenAPI Generator generates classes that can't build for models with two (or more) levels of inheritance and a discriminator Micronaut OpenAPI Generator (still) generates classes that can't build for models with two (or more) levels of inheritance and a discriminator Nov 22, 2023
@altro3
Copy link
Collaborator

altro3 commented Nov 22, 2023

I think, gradle plugin uses old version of micronaut-openapi micronaut-projects/micronaut-gradle-plugin#867

@altro3
Copy link
Collaborator

altro3 commented Nov 22, 2023

yeah, it's true
изображение

@altro3
Copy link
Collaborator

altro3 commented Nov 23, 2023

@runenielsen frrom documentation:
изображение

You can set version 6.1.0 of micronaut-openapi yourself

@altro3
Copy link
Collaborator

altro3 commented Nov 23, 2023

Wait this PR: micronaut-projects/micronaut-gradle-plugin#807 and new gradle plugin release

@runenielsen
Copy link
Author

Thanks, @altro3 🙂

@altro3
Copy link
Collaborator

altro3 commented Dec 4, 2023

@runenielsen
Copy link
Author

@altro3 : Thanks.

I haven't checked out the Serde model generator, right now we are using the Jackson generator due to the problems in the other one.

In the Jackson generator, I am with the newest Gradle plugin v4.2.1 now getting private constructors in my generated model classes without required parameters... so they can't be instantiated 🙁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants