-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[Microprofile] Add option to use tags a client keys and server generator #16673
[Microprofile] Add option to use tags a client keys and server generator #16673
Conversation
…erfaces using Mutiny in Java Microprofile library
…roprofile-improvements # Conflicts: # samples/openapi3/client/petstore/spring-stubs-skip-default-interface/src/main/java/org/openapitools/model/ModelApiResponse.java # samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/CatAllOf.java # samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/DogAllOf.java # samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/HasOnlyReadOnly.java # samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Model200Response.java # samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/ModelApiResponse.java # samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/ModelList.java # samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/ModelReturn.java # samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/SpecialModelName.java # samples/openapi3/server/petstore/springboot-source/src/main/java/org/openapitools/model/ModelApiResponse.java # samples/server/petstore/spring-mvc-default-value/src/main/java/org/openapitools/api/TestHeadersApi.java # samples/server/petstore/spring-mvc-default-value/src/main/java/org/openapitools/api/TestQueryParamsApi.java # samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/AnotherFakeApi.java # samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/FakeApi.java # samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/FakeClassnameTestApi.java # samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/PetApi.java # samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/StoreApi.java # samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/UserApi.java # samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/BigCatAllOf.java # samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/CatAllOf.java # samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/DogAllOf.java # samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/EnumTest.java # samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/FormatTest.java # samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/HasOnlyReadOnly.java # samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Model200Response.java # samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/ModelList.java # samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/ModelReturn.java # samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/SpecialModelName.java # samples/server/petstore/spring-mvc-j8-async/src/main/resources/openapi.yaml # samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/AnotherFakeApi.java # samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/FakeApi.java # samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/FakeClassnameTestApi.java # samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/PetApi.java # samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/StoreApi.java # samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/UserApi.java # samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/BigCatAllOf.java # samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/CatAllOf.java # samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/DogAllOf.java # samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/EnumTest.java # samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/FormatTest.java # samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/HasOnlyReadOnly.java # samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Model200Response.java # samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/ModelList.java # samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/ModelReturn.java # samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/SpecialModelName.java # samples/server/petstore/spring-mvc-j8-localdatetime/src/main/resources/openapi.yaml # samples/server/petstore/spring-mvc-no-nullable/.openapi-generator/VERSION # samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/api/AnotherFakeApi.java # samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/api/FakeApi.java # samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/api/FakeClassnameTestApi.java # samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/api/PetApi.java # samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/api/StoreApi.java # samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/model/BigCatAllOf.java # samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/model/CatAllOf.java # samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/model/DogAllOf.java # samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/model/EnumTest.java # samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/model/FormatTest.java # samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/model/HasOnlyReadOnly.java # samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/model/Model200Response.java # samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/model/ModelApiResponse.java # samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/model/ModelReturn.java # samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/model/SpecialModelName.java # samples/server/petstore/spring-mvc-no-nullable/src/main/resources/openapi.yaml # samples/server/petstore/spring-mvc-spring-pageable/.openapi-generator/VERSION # samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/api/AnotherFakeApi.java # samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/api/FakeApi.java # samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/api/FakeClassnameTestApi.java # samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/api/PetApi.java # samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/api/UserApi.java # samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/model/CatAllOf.java # samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/model/DogAllOf.java # samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/model/EnumTest.java # samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/model/FormatTest.java # samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/model/HasOnlyReadOnly.java # samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/model/Model200Response.java # samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/model/ModelApiResponse.java # samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/model/ModelList.java # samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/model/ModelReturn.java # samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/model/SpecialModelName.java # samples/server/petstore/spring-mvc-spring-pageable/src/main/resources/openapi.yaml # samples/server/petstore/spring-mvc/.openapi-generator/VERSION # samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/AnotherFakeApi.java # samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeApi.java # samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeClassnameTestApi.java # samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/StoreApi.java # samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/UserApi.java # samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/BigCatAllOf.java # samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/CatAllOf.java # samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/DogAllOf.java # samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/EnumTest.java # samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/FormatTest.java # samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/HasOnlyReadOnly.java # samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Model200Response.java # samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/ModelApiResponse.java # samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/ModelList.java # samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/ModelReturn.java # samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/SpecialModelName.java # samples/server/petstore/spring-mvc/src/main/resources/openapi.yaml
This reverts commit b5bcbde.
Some other generators than those for Micronaut don't seem to be able to handle this case, so we don't add it to the general pet store document.
looks like there're some unresolved merge conflicts do you minding merging the latest master into your branch and regenerating the samples? |
Done. Sorry for the delay, I was on holidays |
@wing328 There is still some failure, but it seems to me that it's not related to my changes because it's in some JavaScript code. |
@kiwi-oss thanks for the PR. please PM me via Slack when you've to further discuss this. https://join.slack.com/t/openapi-generator/shared_invite/zt-12jxxd7p2-XUeQM~4pzsU9x~eGLQqX2g |
63d1367
to
a58b998
Compare
@@ -0,0 +1,8 @@ | |||
generatorName: microprofile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we name the generator as "java-microprofile" instead following the convention of other java server generators?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -0,0 +1,8 @@ | |||
generatorName: microprofile | |||
outputDir: samples/server/petstore/microprofile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add the new folder to .github/workflows/samples-java-server-jdk8.yaml
so that CI will test it moving forward
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class MicroprofileServerCodegen extends JavaClientCodegen { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
personally I would suggest NOT to extend a java server with JavaClientCodegen as most options available in JavaClientCodegen won't make sense in the server generator if I understand it correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The java generator, using the microprofile library, generates an interface that could be used for either client or server.
This is what is being extended. I understand that it seems odd to have a server code generator inherit from a client generator. But we would have to re write the functionality of the java generator.
Do you have a suggestion of how to proceed with this?
Or perhaps it could be listed as a MicroprofileClientCodegen
because it could be used for either client of server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right seems odd but to me but it's not a showstopper.
if this way is a good starting point to add the server generator for microprofile, i'm totally ok with that.
…ml so that CI will test it moving forward
...penapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig
Outdated
Show resolved
Hide resolved
can you please review the test failure when you've time? https://github.com/OpenAPITools/openapi-generator/actions/runs/8880595750/job/24389070322?pr=16673 |
This is caused by a mixing of Junit 4 and Junit 5, and unsatisfied dependencies. It seems this was introduced in 7.5.0 and that there have been issues raised for it /issues/18465 |
The java microprofile library does not build generate correctly, as the |
can you please review the test failure in https://github.com/OpenAPITools/openapi-generator/actions/runs/8892195364/job/24617679907?pr=16673 when you've time? |
done |
thanks for the PR. all tests passed. if no one has further feedback, I'll merge it tomorrow. cc @bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10) @martin-mfg (2023/08) |
This adds two features for Microprofile.
One is the
configKeyFromClassName
option that allows naming the configuration key of the@RegisterRestClient
annotation after the annotated API interface.The effect can be seen in the interfaces under
samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api
. Compare to those under e.g.samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/api
where a fixed key is used.The other addition is a server generator which has the feature of properly handling cases where multiple HTTP 2xx responses are defined, see
GET /pet/findByTags
inmodules/openapi-generator/src/test/resources/3_0/petstore-multiple-2xx-responses.yaml
.The various 2xx responses can return different things, e.g. 200 the whole resource, 204 nothing, 206 a partial resource and so on. Therefore, the return type of the related server interface method has to return a generic response type. This can be seen for
findPetsByTags
insamples/server/petstore/microprofile/src/main/java/org/openapitools/server/api/PetApi.java
.@bbdouglas @sreeshas @jfiala @lukoyanov @cbornet @jeff9finger @karismann @Zomzog @lwlee2608 @martin-mfg
PR checklist
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.For Windows users, please run the script in Git BASH.
master
(upcoming 7.1.0 minor release - breaking changes with fallbacks),8.0.x
(breaking changes without fallbacks)