Skip to content

Commit 73ea1bf

Browse files
committed
Add test.
1 parent bb89c0e commit 73ea1bf

File tree

3 files changed

+111
-2
lines changed

3 files changed

+111
-2
lines changed

springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/app155/HelloController.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,11 @@ public ResponseEntity<String> sayHello( @ParameterObject final ConcreteIntParame
4040
return new ResponseEntity<String>("{\"Say\": \"Hello\"}", HttpStatus.OK);
4141
}
4242

43+
@GetMapping( "/test3")
44+
public ResponseEntity<String> sayHello( @ParameterObject final NestedParameterObject test) {
45+
System.out.println("Field B = " + test);
46+
return new ResponseEntity<String>("{\"Say\": \"Hello\"}", HttpStatus.OK);
47+
}
48+
4349

4450
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package test.org.springdoc.api.app155;
2+
3+
public class NestedParameterObject {
4+
5+
ConcreteIntParameterObject concreteIntParameter;
6+
7+
ConcreteParameterObject concreteParameter;
8+
9+
public ConcreteIntParameterObject getConcreteIntParameter() {
10+
return concreteIntParameter;
11+
}
12+
13+
public void setConcreteIntParameter(ConcreteIntParameterObject concreteIntParameter) {
14+
this.concreteIntParameter = concreteIntParameter;
15+
}
16+
17+
public ConcreteParameterObject getConcreteParameter() {
18+
return concreteParameter;
19+
}
20+
21+
public void setConcreteParameter(ConcreteParameterObject concreteParameter) {
22+
this.concreteParameter = concreteParameter;
23+
}
24+
}

springdoc-openapi-webmvc-core/src/test/resources/results/app155.json

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,91 @@
1111
}
1212
],
1313
"paths": {
14-
"/test2": {
14+
"/test3": {
1515
"get": {
1616
"tags": [
1717
"hello-controller"
1818
],
1919
"operationId": "sayHello",
20+
"parameters": [
21+
{
22+
"name": "concreteIntParameter.primitiveConcreteField",
23+
"in": "query",
24+
"required": false,
25+
"schema": {
26+
"type": "integer",
27+
"format": "int32"
28+
}
29+
},
30+
{
31+
"name": "concreteIntParameter.primitiveBaseField",
32+
"in": "query",
33+
"required": false,
34+
"schema": {
35+
"type": "integer",
36+
"format": "int32"
37+
}
38+
},
39+
{
40+
"name": "concreteIntParameter.genericField",
41+
"in": "query",
42+
"required": false,
43+
"schema": {
44+
"type": "integer",
45+
"format": "int32"
46+
}
47+
},
48+
{
49+
"name": "concreteParameter.primitiveConcreteField",
50+
"in": "query",
51+
"required": false,
52+
"schema": {
53+
"type": "integer",
54+
"format": "int32"
55+
}
56+
},
57+
{
58+
"name": "concreteParameter.primitiveBaseField",
59+
"in": "query",
60+
"required": false,
61+
"schema": {
62+
"type": "integer",
63+
"format": "int32"
64+
}
65+
},
66+
{
67+
"name": "concreteParameter.genericField",
68+
"in": "query",
69+
"required": false,
70+
"schema": {
71+
"type": "string",
72+
"enum": [
73+
"ONE",
74+
"TWO"
75+
]
76+
}
77+
}
78+
],
79+
"responses": {
80+
"200": {
81+
"description": "OK",
82+
"content": {
83+
"*/*": {
84+
"schema": {
85+
"type": "string"
86+
}
87+
}
88+
}
89+
}
90+
}
91+
}
92+
},
93+
"/test2": {
94+
"get": {
95+
"tags": [
96+
"hello-controller"
97+
],
98+
"operationId": "sayHello_1",
2099
"parameters": [
21100
{
22101
"name": "primitiveConcreteField",
@@ -65,7 +144,7 @@
65144
"tags": [
66145
"hello-controller"
67146
],
68-
"operationId": "sayHello_1",
147+
"operationId": "sayHello_2",
69148
"parameters": [
70149
{
71150
"name": "primitiveConcreteField",

0 commit comments

Comments
 (0)