Skip to content

Commit 93e4884

Browse files
committed
fix: add annotation to method parameter
1 parent d39e015 commit 93e4884

File tree

4 files changed

+4
-3
lines changed
  • modules/openapi-generator/src
  • samples/client/petstore
    • spring-cloud-date-time/src/main/java/org/openapitools/model
    • spring-cloud-deprecated/src/main/java/org/openapitools/model

4 files changed

+4
-3
lines changed

modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ public {{>sealed}}class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}
349349
* Convert the given object to string with each line indented by 4 spaces
350350
* (except the first line).
351351
*/
352-
private String toIndentedString(Object o) {
352+
private String toIndentedString({{>nullableAnnotation}}Object o) {
353353
if (o == null) {
354354
return "null";
355355
}

modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5117,6 +5117,7 @@ public void testCollectionTypesWithDefaults_issue_18102() throws IOException {
51175117
.fileContains("@Nullable Set<String> stringSet")
51185118
.fileContains("private Set<String> stringDefaultSet = new LinkedHashSet<>(Arrays.asList(\"A\", \"B\"));")
51195119
.fileContains("private Set<String> stringEmptyDefaultSet = new LinkedHashSet<>();")
5120+
.fileContains("private String toIndentedString(@Nullable Object o)")
51205121
.fileDoesNotContain("private List<@Valid TagDto> tags = new ArrayList<>()")
51215122
.fileDoesNotContain("private Set<@Valid TagDto> tagsUnique = new LinkedHashSet<>()")
51225123
.fileDoesNotContain("private List<String> stringList = new ArrayList<>()")

samples/client/petstore/spring-cloud-date-time/src/main/java/org/openapitools/model/Pet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public String toString() {
212212
* Convert the given object to string with each line indented by 4 spaces
213213
* (except the first line).
214214
*/
215-
private String toIndentedString(Object o) {
215+
private String toIndentedString(@Nullable Object o) {
216216
if (o == null) {
217217
return "null";
218218
}

samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Category.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public String toString() {
9999
* Convert the given object to string with each line indented by 4 spaces
100100
* (except the first line).
101101
*/
102-
private String toIndentedString(Object o) {
102+
private String toIndentedString(@Nullable Object o) {
103103
if (o == null) {
104104
return "null";
105105
}

0 commit comments

Comments
 (0)