Skip to content
This repository was archived by the owner on Mar 16, 2025. It is now read-only.

Commit 08c5445

Browse files
committed
#45, test to initialize "null" property
1 parent 72a27e7 commit 08c5445

File tree

5 files changed

+51
-0
lines changed

5 files changed

+51
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
items:
22
- generated/api/Api.java
33
- generated/model/Foo.java
4+
- generated/model/Foo2.java

src/testInt/resources/tests/object-nullable-properties/generated/api/Api.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
import annotation.Mapping;
99
import annotation.Parameter;
1010
import generated.model.Foo;
11+
import generated.model.Foo2;
1112

1213
public interface Api {
1314

1415
@Mapping("/foo")
1516
void patchFoo(@Parameter Foo body);
1617

18+
@Mapping("/foo2")
19+
void patchFoo2(@Parameter Foo2 body);
20+
1721
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* This class is auto generated by https://github.com/hauner/openapi-processor-core.
3+
* TEST ONLY.
4+
*/
5+
6+
package generated.model;
7+
8+
import com.fasterxml.jackson.annotation.JsonProperty;
9+
import org.openapitools.jackson.nullable.JsonNullable;
10+
11+
public class Foo2 {
12+
13+
@JsonProperty("bar")
14+
private JsonNullable<String> bar = JsonNullable.undefined();
15+
16+
public JsonNullable<String> getBar() {
17+
return bar;
18+
}
19+
20+
public void setBar(JsonNullable<String> bar) {
21+
this.bar = bar;
22+
}
23+
24+
}

src/testInt/resources/tests/object-nullable-properties/inputs/mapping.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ map:
88
paths:
99
/foo:
1010
null: org.openapitools.jackson.nullable.JsonNullable
11+
12+
/foo2:
13+
null: org.openapitools.jackson.nullable.JsonNullable = JsonNullable.undefined()

src/testInt/resources/tests/object-nullable-properties/inputs/openapi.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ paths:
1515
'204':
1616
description: empty
1717

18+
/foo2:
19+
patch:
20+
requestBody:
21+
content:
22+
application/json:
23+
schema:
24+
$ref: '#/components/schemas/Foo2'
25+
responses:
26+
'204':
27+
description: empty
28+
1829
components:
1930
schemas:
2031

@@ -25,3 +36,11 @@ components:
2536
bar:
2637
nullable: true
2738
type: string
39+
40+
Foo2:
41+
description: a Foo 2
42+
type: object
43+
properties:
44+
bar:
45+
nullable: true
46+
type: string

0 commit comments

Comments
 (0)