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

Initial re-integration of the OpenAPI generator into Micronaut OpenAPI #1040

Merged
merged 9 commits into from
Jun 13, 2023

Conversation

melix
Copy link
Contributor

@melix melix commented Jun 2, 2023

This commit migrates the OpenAPI code generator from the external OpenAPI generator project to this project. A new module named openapi-generator depends on OpenAPI generator and replicates features which are currently found in that project. However, there are a few changes:

  • the build file generation has been removed. Because we're going to integrate this in build tools, it doesn't make sense to generate these. Even if we use it in Micronaut Launch, then it's the responsibility of Launch to generate the files. One drawback is that the user has to figure out which dependencies to add for the client or server, if they use the build tool plugins.
  • a type-safe API has been introduced to configure options. It is actually hard to figure out all the options we can configure and are relevant to the code, this work is therefore in progress.
  • the default package for javax annotations was moved to jakarta

Test projects are used to make sure that we can generate at least one client and one server, with hardcoded options. We're using generated sources, which are not supposed to be changed by the user. It simulates what the build tool plugins would do, except that these would probably generate sources in different folders based on what we generate.

@andriy-dmytruk can you figure out why the test io.micronaut.openapi.generator.MicronautServerCodegenTest#testExtraAnnotations is failing? Apparently an extra annotation declared in the spec isn't applied to a field. It may be related to renames I have made but I am not sure.

melix and others added 6 commits June 12, 2023 11:09
This commit migrates the OpenAPI code generator from the external
OpenAPI generator project to this project. A new module named
`openapi-generator` depends on OpenAPI generator and replicates
features which are currently found in that project. However, there
are a few changes:

- the build file generation has been removed. Because we're going
to integrate this in build tools, it doesn't make sense to generate
these. Even if we use it in Micronaut Launch, then it's the
responsibility of Launch to generate the files. One drawback is
that the user has to figure out which dependencies to add for
the client or server, if they use the build tool plugins.
- a type-safe API has been introduced to configure options. It
is actually hard to figure out all the options we can configure
and are relevant to the code, this work is therefore in progress.
- the default package for javax annotations was moved to jakarta

Test projects are used to make sure that we can generate at least
one client and one server, with hardcoded options. We're using
generated sources, which are not supposed to be changed by the
user. It simulates what the build tool plugins would do, except
that these would probably generate sources in different folders
based on what we generate.
Rename the package to api and add Api suffix to the interfaces. Their implementations will have the Controller suffix
This commit extends the builder API in order to be able
to use custom code generators. This is required whenever the
standard code generators are not enough. In this case, the
user would have to provide not only the code generator, but
also implement a builder to configure the options specific
for that code generator.
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 88 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@melix melix marked this pull request as ready for review June 12, 2023 16:36
@melix melix requested a review from graemerocher June 12, 2023 16:36
@melix melix self-assigned this Jun 12, 2023
@melix melix merged commit 08b3027 into master Jun 13, 2023
@melix melix deleted the cc/issue-1037 branch June 13, 2023 15:56
@sdelamo
Copy link
Contributor

sdelamo commented Jun 14, 2023

we missed documentation in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants