Skip to content

Commit d4c9198

Browse files
authored
Add test for fixed NPE in rename of parameter (#555)
Closes #488 Closes #516
1 parent 6f79b10 commit d4c9198

File tree

3 files changed

+202
-0
lines changed

3 files changed

+202
-0
lines changed

core/src/test/java/org/openapitools/openapidiff/core/ParameterDiffTest.java

+6
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,10 @@ public void issue458ExclusiveMinimumTrueRemoved() {
8888
assertOpenApiChangedEndpoints(
8989
"issue-458-integer-limits_11.yaml", "issue-458-integer-limits_13.yaml");
9090
}
91+
92+
@Test
93+
public void issue488RenameParameterAddAndRemoveParameterReturnFalse() {
94+
assertOpenApiChangedEndpoints(
95+
"issue-488-1.json", "issue-488-2.json");
96+
}
9197
}
+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"openapi": "3.0.1",
3+
"info": {
4+
"title": "Test-API",
5+
"description": "Testdescription",
6+
"version": "v1"
7+
},
8+
"paths": {
9+
"/api/v1/test": {
10+
"get": {
11+
"tags": [
12+
"TestTag"
13+
],
14+
"summary": "Retrieve a list Test objects",
15+
"description": "Usage with testId parameter is recommended.",
16+
"parameters": [
17+
{
18+
"name": "testId",
19+
"in": "query",
20+
"description": "rename of prop before",
21+
"schema": {
22+
"type": "string"
23+
}
24+
},
25+
{
26+
"name": "dateFrom",
27+
"in": "query",
28+
"description": "Searches documents with creation date equal or younger specified timestamp",
29+
"schema": {
30+
"type": "string"
31+
}
32+
},
33+
{
34+
"name": "dateTo",
35+
"in": "query",
36+
"description": "Searches documents with creation date equal or older than specified timestamp",
37+
"schema": {
38+
"type": "string"
39+
}
40+
}
41+
],
42+
"responses": {
43+
"200": {
44+
"description": "OK",
45+
"content": {
46+
"application/json": {
47+
"schema": {
48+
"type": "array",
49+
"items": {
50+
"$ref": "#/components/schemas/TestDTO"
51+
}
52+
}
53+
}
54+
}
55+
},
56+
"401": {
57+
"description": "Unauthorized"
58+
}
59+
}
60+
}
61+
}
62+
},
63+
"components": {
64+
"schemas": {
65+
"TestDTO": {
66+
"type": "object",
67+
"properties": {
68+
"Id": {
69+
"type": "string",
70+
"nullable": true
71+
},
72+
"Timestamp": {
73+
"type": "string",
74+
"format": "date-time"
75+
},
76+
"Test": {
77+
"type": "string",
78+
"nullable": true
79+
}
80+
},
81+
"additionalProperties": false
82+
}
83+
},
84+
"securitySchemes": {
85+
"BearerAuth": {
86+
"type": "apiKey",
87+
"description": "Fill in your acquired bearer token here, must be like 'Bearer TOKEN_HERE'",
88+
"name": "Authorization",
89+
"in": "header"
90+
}
91+
}
92+
},
93+
"security": [
94+
{
95+
"BearerAuth": [ ]
96+
}
97+
]
98+
}
+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"openapi": "3.0.1",
3+
"info": {
4+
"title": "Test-API",
5+
"description": "Testdescription",
6+
"version": "v1"
7+
},
8+
"paths": {
9+
"/api/v1/test": {
10+
"get": {
11+
"tags": [
12+
"TestTag"
13+
],
14+
"summary": "Retrieve a list Test objects",
15+
"description": "Usage with testId parameter is recommended.",
16+
"parameters": [
17+
{
18+
"name": "testIdWillBreak",
19+
"in": "query",
20+
"description": "rename of prop after",
21+
"schema": {
22+
"type": "string"
23+
}
24+
},
25+
{
26+
"name": "dateFrom",
27+
"in": "query",
28+
"description": "Searches documents with creation date equal or younger specified timestamp",
29+
"schema": {
30+
"type": "string"
31+
}
32+
},
33+
{
34+
"name": "dateTo",
35+
"in": "query",
36+
"description": "Searches documents with creation date equal or older than specified timestamp",
37+
"schema": {
38+
"type": "string"
39+
}
40+
}
41+
],
42+
"responses": {
43+
"200": {
44+
"description": "OK",
45+
"content": {
46+
"application/json": {
47+
"schema": {
48+
"type": "array",
49+
"items": {
50+
"$ref": "#/components/schemas/TestDTO"
51+
}
52+
}
53+
}
54+
}
55+
},
56+
"401": {
57+
"description": "Unauthorized"
58+
}
59+
}
60+
}
61+
}
62+
},
63+
"components": {
64+
"schemas": {
65+
"TestDTO": {
66+
"type": "object",
67+
"properties": {
68+
"Id": {
69+
"type": "string",
70+
"nullable": true
71+
},
72+
"Timestamp": {
73+
"type": "string",
74+
"format": "date-time"
75+
},
76+
"Test": {
77+
"type": "string",
78+
"nullable": true
79+
}
80+
},
81+
"additionalProperties": false
82+
}
83+
},
84+
"securitySchemes": {
85+
"BearerAuth": {
86+
"type": "apiKey",
87+
"description": "Fill in your acquired bearer token here, must be like 'Bearer TOKEN_HERE'",
88+
"name": "Authorization",
89+
"in": "header"
90+
}
91+
}
92+
},
93+
"security": [
94+
{
95+
"BearerAuth": [ ]
96+
}
97+
]
98+
}

0 commit comments

Comments
 (0)