Skip to content

Commit d0a73c6

Browse files
committed
fix(diff): fixed diff status on added required property
A non-required added property in a request should not be reported as a breaking change. Fixed the change status of added properties depending on being required or not in the new specification. * fixes #2962 Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
1 parent 728ad34 commit d0a73c6

2 files changed

Lines changed: 108 additions & 0 deletions

File tree

diff/fixtures/bugs/2962/new.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"swagger": "2.0",
3+
"info": {
4+
"title": "Swagger Fixture",
5+
"version": "1.0"
6+
},
7+
"paths": {
8+
"/a/{id}": {
9+
"post": {
10+
"parameters": [
11+
{
12+
"name": "",
13+
"in": "body",
14+
"schema": { "$ref": "#/definitions/A2" }
15+
}
16+
],
17+
"responses": {
18+
"200": {
19+
"description": "200 response",
20+
"schema": { "$ref": "#/definitions/A3" }
21+
}
22+
}
23+
}
24+
}
25+
},
26+
"definitions": {
27+
"A2": {
28+
"type": "object",
29+
"required": [ "name", "field4" ],
30+
"properties": {
31+
"name": { "type": "string" },
32+
"description": { "type": "string" },
33+
"field3": { "type": "string" },
34+
"field4": { "type": "string" }
35+
}
36+
},
37+
"A3": {
38+
"type": "object",
39+
"properties": {
40+
"id": { "type": "integer" },
41+
"name": { "type": "string" },
42+
"otherDeletedName":{"type":"string","deprecated":true},
43+
"description": { "type": "string" },
44+
"letters": {
45+
"type": "array",
46+
"items": { "type": "string" }
47+
},
48+
"attributes": {
49+
"type": "object",
50+
"additionalProperties": { "type": "string" }
51+
}
52+
}
53+
}
54+
}
55+
}

diff/fixtures/bugs/2962/old.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"swagger": "2.0",
3+
"info": {
4+
"title": "Swagger Fixture",
5+
"version": "1.0"
6+
},
7+
"paths": {
8+
"/a/{id}": {
9+
"post": {
10+
"parameters": [
11+
{
12+
"name": "",
13+
"in": "body",
14+
"schema": { "$ref": "#/definitions/A2" }
15+
}
16+
],
17+
"responses": {
18+
"200": {
19+
"description": "200 response",
20+
"schema": { "$ref": "#/definitions/A3" }
21+
}
22+
}
23+
}
24+
}
25+
},
26+
"definitions": {
27+
"A2": {
28+
"type": "object",
29+
"required": [ "name", "description" ],
30+
"properties": {
31+
"name": { "type": "string" },
32+
"description": { "type": "string" }
33+
}
34+
},
35+
"A3": {
36+
"type": "object",
37+
"properties": {
38+
"id": { "type": "integer" },
39+
"name": { "type": "string" },
40+
"otherDeletedName":{"type":"string","deprecated":true},
41+
"description": { "type": "string" },
42+
"letters": {
43+
"type": "array",
44+
"items": { "type": "string" }
45+
},
46+
"attributes": {
47+
"type": "object",
48+
"additionalProperties": { "type": "string" }
49+
}
50+
}
51+
}
52+
}
53+
}

0 commit comments

Comments
 (0)