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
{{ message }}
Repository navigation
Commit 71c19ab
Browse filesBrowse the repository at this point in the historyBrowse files
jaxrs-spec had no jspecify support at all — no `useJspecify` option, and
the generator emitted no nullability annotations for any library. This
adds it generator-wide rather than per-library, because the model and
parameter templates are shared by all six libraries (default, quarkus,
thorntail, openliberty, helidon, kumuluzee); only quarkus overrides
formParams.
- JavaJAXRSSpecServerCodegen: `useJspecify` cliOption, applyJspecify()
and the Nullable imports for models and operations.
- Shared pojo.mustache (field, getter, setter, fluent setter) and the
six parameter partials, plus the quarkus formParams override.
- New JavaJaxRS/spec copies of modelPackageInfo/apiPackageInfo and the
nullable* partials: unlike the java client libraries, which all share
one `Java` template dir, jaxrs-spec has its own with no fallback.
- Base pom swaps jsr305 for jspecify under the flag, matching how the
java client libraries handle it; the quarkus pom adds jspecify.
applyJspecify() must run *after* the `supportingFiles.clear()` in
processOpts(), which would otherwise drop the @NullMarked package-info
files.
jaxrs-cxf-cdi extends this generator but uses its own cxf-cdi template
directory, so it would have advertised the option without honouring it —
the exact defect this change fixes elsewhere. It calls removeOption,
alongside the existing removeOption(GENERATE_JSON_CREATOR).
Every template change is guarded by {{#useJspecify}}: flag-off output is
byte-identical to before, verified by diffing against a jar built from
the parent branch for both the default and quarkus libraries.
Adds a sample (jaxrs-spec-quarkus-jspecify, registered in samples-jdk17
since the quarkus library targets Java 17) and two tests covering the
annotations, type-use placement on qualified types, and that the flag
off still emits jsr305 and no annotations.
Copy file name to clipboardExpand all lines: docs/generators/jaxrs-spec.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,6 +86,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
86
86
|useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison||false|
87
87
|useJakartaEe|whether to use Jakarta EE namespace instead of javax||false|
88
88
|useJakartaSecurityAnnotations|Whether to generate Jakarta security annotations (@RolesAllowed, @PermitAll). Requires useJakartaEe=true. Currently only supported when library is set to quarkus.||false|
89
+
|useJspecify|Use JSpecify for null checks: @NullMarked package-info and @Nullable on optional properties and parameters.||false|
89
90
|useMicroProfileOpenAPIAnnotations|Whether to generate Microprofile OpenAPI annotations. Only valid when library is set to quarkus.||false|
90
91
|useMutiny|Whether to use Smallrye Mutiny instead of CompletionStage for asynchronous computation. Only valid when library is set to quarkus.||false|
91
92
|useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface||false|
Copy file name to clipboardExpand all lines: modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSCXFCDIServerCodegen.java
+10Lines changed: 10 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,9 @@ public JavaJAXRSCXFCDIServerCodegen() {
Copy file name to clipboardExpand all lines: modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java
+22Lines changed: 22 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -171,6 +171,7 @@ public JavaJAXRSSpecServerCodegen() {
171
171
cliOptions.add(CliOption.newBoolean(GENERATE_JSON_CREATOR, "Whether to generate @JsonCreator constructor for required properties.", generateJsonCreator));
172
172
cliOptions.add(CliOption.newBoolean(USE_ENUM_CASE_INSENSITIVE, "Use `equalsIgnoreCase` when String for enum comparison", useEnumCaseInsensitive));
173
173
cliOptions.add(CliOption.newBoolean(USE_SEALED, "Whether to generate sealed model interfaces and classes.", useSealed));
174
+
cliOptions.add(CliOption.newBoolean(USE_JSPECIFY, "Use JSpecify for null checks: @NullMarked package-info and @Nullable on optional properties and parameters.", useJspecify));
0 commit comments