Repository navigation
[Java][Client][MicroProfile] Add microprofileRegisterRestClient option - #25281
karan-rastogi wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
Add a new boolean option microprofileRegisterRestClient (default: true) to control whether the generated MicroProfile API interfaces are annotated with @RegisterRestClient and import the annotation. When set to false, the annotation and its import are omitted from the generated interfaces, allowing them to be used as base contracts extended by application-owned REST clients, without registering the generated base interface as a separate CDI REST client. The rest of the generated code is unchanged: JAX-RS annotations, operation signatures, and return types remain identical. Default behavior (true) preserves existing output. Added unit tests to verify both the default (true) and disabled (false) cases. Fixes OpenAPITools#25264
cc1973f to
edca58d
Compare
…roprofileRegisterRestClient option
da39c2c to
8028f16
Compare
|
@cubic-dev-ai please re-review the latest changes. |
@karan-rastogi I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 8 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
|
Hi @wing328 ! Just a quick note on the failing CI check: All 139 other checks, including the MicroProfile tests and AI review, are passing successfully. Please let me know if there's anything else needed from my side. Thanks for your time! |
|
thanks for the PR https://github.com/OpenAPITools/openapi-generator/actions/runs/39015368208/job/117346270329?pr=25281 already fixed in the latest master 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) @KannaKim (2026/07) |
|
Thanks @wing328! Done. Moved the closing tags to separate lines and regenerated the samples. |
PR checklist
masterbranch of the repository.mvn clean packagein the root of the repository and it passed.PR Type
New feature
Description of the changes
When generating a Java client with
library=microprofile, the generated API interfaces are always annotated with@RegisterRestClient.In some use cases, these interfaces are intended to serve as base contracts extended by application-owned CDI REST clients. In that scenario, the base interface should not be registered as a CDI REST client itself.
This PR adds a new boolean config option
microprofileRegisterRestClient(default:true) that controls generation of both:@RegisterRestClientannotationWhen set to
false, the rest of the generated code is unchanged (JAX-RS annotations, operation signatures, return types). Default behavior (true) preserves existing output.Verification
Built the generator:
Generated clients with
library=microprofileand verified both cases:Default (true):
Option false:
Added unit tests in
JavaClientCodegenTest:testMicroprofileRegisterRestClientDefaultTrue— verifies annotation present by defaulttestMicroprofileRegisterRestClientDisabled— verifies annotation and import omitted when falseBoth tests pass:
Related issues
Technical committee
@OpenAPITools/openapi-generator-java-technical-committee
Summary by cubic
Adds a
microprofileRegisterRestClientoption (default:true) to the Java client generator for themicroprofilelibrary, allowing generated API interfaces to omit the@RegisterRestClientannotation and its import when set tofalse.This lets generated interfaces be used as base contracts extended by application-owned CDI REST clients, without registering the base interface itself. When disabled, the rest of the generated code is unchanged.
processOpts.api.mustachetemplate with the option.true) and disabled (false) cases.Fixes #25264.
Written for commit 29244b8. Summary will update on new commits.