Skip to content

Commit f4de345

Browse files
Ignacio-Vidalclaude
andcommitted
[jaxrs-spec][quarkus] Add useQuarkusSecurityAnnotations CLI option
Registers a new boolean generator option (default false, quarkus library only) that will gate emission of Quarkus security annotations (@authenticated, @RolesAllowed, @permitAll) in subsequent PRs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 60ef743 commit f4de345

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
5353
public static final String USE_MUTINY = "useMutiny";
5454
public static final String OPEN_API_SPEC_FILE_LOCATION = "openApiSpecFileLocation";
5555
public static final String GENERATE_JSON_CREATOR = "generateJsonCreator";
56+
public static final String USE_QUARKUS_SECURITY_ANNOTATIONS = "useQuarkusSecurityAnnotations";
5657

5758
public static final String QUARKUS_LIBRARY = "quarkus";
5859
public static final String THORNTAIL_LIBRARY = "thorntail";
@@ -68,6 +69,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
6869
private boolean useSwaggerV3Annotations = false;
6970
private boolean useMicroProfileOpenAPIAnnotations = false;
7071
private boolean useMutiny = false;
72+
private boolean useQuarkusSecurityAnnotations = false;
7173

7274
@Getter @Setter
7375
protected boolean generateJsonCreator = true;
@@ -147,6 +149,7 @@ public JavaJAXRSSpecServerCodegen() {
147149
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."));
148150
cliOptions.add(CliOption.newBoolean(SUPPORT_ASYNC, "Wrap responses in CompletionStage type, allowing asynchronous computation (requires JAX-RS 2.1).", supportAsync));
149151
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));
150153
cliOptions.add(CliOption.newBoolean(GENERATE_JSON_CREATOR, "Whether to generate @JsonCreator constructor for required properties.", generateJsonCreator));
151154
}
152155

@@ -189,6 +192,10 @@ public void processOpts() {
189192
convertPropertyToBooleanAndWriteBack(USE_MUTINY, value -> useMutiny = value);
190193
}
191194

195+
if (QUARKUS_LIBRARY.equals(library)) {
196+
convertPropertyToBooleanAndWriteBack(USE_QUARKUS_SECURITY_ANNOTATIONS, value -> useQuarkusSecurityAnnotations = value);
197+
}
198+
192199
convertPropertyToBooleanAndWriteBack(GENERATE_JSON_CREATOR, this::setGenerateJsonCreator);
193200

194201
if (additionalProperties.containsKey(OPEN_API_SPEC_FILE_LOCATION)) {

0 commit comments

Comments
 (0)