Repository navigation
Closed
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When enabling generateConstructorWithAllArgs @Nullable annotations are not generated for the parameters of the all args constructor:
public class GetFoo200Response {
public static final String JSON_PROPERTY_FOO = "foo";
private String foo;
public static final String JSON_PROPERTY_BAR = "bar";
private JsonNullable<String> bar = JsonNullable.<String>undefined();
public static final String JSON_PROPERTY_BAZ = "baz";
private @Nullable String baz;
public GetFoo200Response() {
}
/**
* Constructor with all args parameters
*/
public GetFoo200Response(@JsonProperty(JSON_PROPERTY_FOO) String foo, @JsonProperty(JSON_PROPERTY_BAR) String bar, @JsonProperty(JSON_PROPERTY_BAZ) String baz) {
this.foo = foo;
this.bar = bar == null ? JsonNullable.<String>undefined() : JsonNullable.of(bar);
this.baz = baz;
}
// remaining code ommitted
}The baz field is marked as nullable, but not the baz parameter on the constructor.
openapi-generator version
7.23.0
OpenAPI declaration file content or url
openapi: "3.0.2"
info:
title: Foo API
version: 1.0.0
paths:
/foo:
get:
operationId: getFoo
responses:
'200':
description: ""
content:
application/json:
schema:
type: object
properties:
foo:
type: string
bar:
type: string
nullable: true
baz:
type: string
nullable: true
required:
- foo
- baz
Generation Details
Used config:
<configOptions>
<dateLibrary>java8</dateLibrary>
<library>webclient</library>
<useJakartaEe>true</useJakartaEe>
<useSpringBoot4>true</useSpringBoot4>
<useJackson3>true</useJackson3>
<useJspecify>true</useJspecify>
<generateConstructorWithAllArgs>true</generateConstructorWithAllArgs>
</configOptions>Steps to reproduce
Related issues/PRs
Suggest a fix
The @Nullable annotations probably need to be added to the constructor in pojo.mustache
Activity
[Java] Generate nullability annotations on all-args constructor param…
[Java] Generate nullability annotations on all-args constructor param…
[Java] Generate nullability annotations on all-args constructor param…