You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[jaxrs-spec][quarkus] Add useQuarkusSecurityAnnotations CLI flag to opt into security annotation emission
Introduces a new `useQuarkusSecurityAnnotations` boolean generator option (default false,
quarkus library only) that gates emission of security annotations (@authenticated and, in
future PRs, @RolesAllowed and @permitAll). Without the flag the generator behaviour is
unchanged; users who manage auth via application.properties can leave it unset.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java
+9-2Lines changed: 9 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -53,6 +53,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
@@ -147,6 +149,7 @@ public JavaJAXRSSpecServerCodegen() {
147
149
cliOptions.add(CliOption.newString(OPEN_API_SPEC_FILE_LOCATION, "Location where the file containing the spec will be generated in the output folder. No file generated when set to null or empty string."));
cliOptions.add(CliOption.newBoolean(USE_MUTINY, "Whether to use Smallrye Mutiny instead of CompletionStage for asynchronous computation. Only valid when library is set to quarkus.", useMutiny));
152
+
cliOptions.add(CliOption.newBoolean(USE_QUARKUS_SECURITY_ANNOTATIONS, "Whether to generate Quarkus security annotations (@Authenticated, @RolesAllowed, @PermitAll). Only valid when library is set to quarkus.", useQuarkusSecurityAnnotations));
150
153
cliOptions.add(CliOption.newBoolean(GENERATE_JSON_CREATOR, "Whether to generate @JsonCreator constructor for required properties.", generateJsonCreator));
151
154
}
152
155
@@ -189,6 +192,10 @@ public void processOpts() {
189
192
convertPropertyToBooleanAndWriteBack(USE_MUTINY, value -> useMutiny = value);
190
193
}
191
194
195
+
if (QUARKUS_LIBRARY.equals(library)) {
196
+
convertPropertyToBooleanAndWriteBack(USE_QUARKUS_SECURITY_ANNOTATIONS, value -> useQuarkusSecurityAnnotations = value);
Copy file name to clipboardExpand all lines: modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSSpecServerCodegenTest.java
+27Lines changed: 27 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1581,6 +1581,7 @@ public void quarkusEmitsAuthenticatedAnnotationForOAuth2(String specPath, boolea
0 commit comments