Skip to content

Commit ae71f56

Browse files
author
Ahmad Moudani
committed
fix: 1) adds supports for Diff to report on changed extension values #2984 and 2) detects request param extension changes #2983
Signed-off-by: Ahmad Moudani <ahmad.moudani@crowdstrike.com>
1 parent 1de0474 commit ae71f56

File tree

3 files changed

+144
-19
lines changed

3 files changed

+144
-19
lines changed

diff/fixtures/extensions.diff.txt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,48 @@ NON-BREAKING CHANGES WITH WARNING:
66
==================================
77
/b/ - x-ext-b-1 - Deleted Extension
88
/b/ - x-ext-b-2 - Added Extension
9-
/b/ - x-ext-b-3 - Added Extension
9+
/b/ - x-ext-b-4 - Changed Extension Value
10+
/b/:get - Request - Body.c.x-ext-param-c - Deleted Extension
11+
/b/:get - Request - FormData.d.x-ext-param-d - Added Extension
1012
/b/:get - Request - Headers.headerB-1.x-header-ext-1 - Deleted Extension
13+
/b/:get - Request - Headers.headerB-1.x-header-ext-3 - Changed Extension Value
1114
/b/:get - Request - Headers.headerB-2.x-header-ext-2 - Added Extension
15+
/b/:get - Request - Path.b.x-ext-param-b - Added Extension
16+
/b/:get - Request - Query.a.x-ext-param-a - Deleted Extension
17+
/b/:get - Request - Query.a.x-ext-param-a-2 - Changed Extension Value
18+
/b/:get - Request - Query.limit.x-ext-param-limit - Deleted Extension
19+
/b/:get - Request - Query.offset.x-ext-param-offset - Added Extension
1220
/b/:get - Request - Responses.x-ext-resp-1 - Deleted Extension
1321
/b/:get - Request - Responses.x-ext-resp-2 - Added Extension
22+
/b/:get - Request - Responses.x-ext-resp-3 - Changed Extension Value
1423
/b/:get - Request - x-ext-1-operation - Added Extension
1524
/b/:get - Request - x-ext-2-operation - Deleted Extension
1625
/b/:get - Request - x-ext-3-operation - Added Extension
26+
/b/:get - Request - x-ext-4-operation - Changed Extension Value
1727
/b/:get -> 200 - Response - Body<A1>.x-b-items-2 - Deleted Extension
1828
/b/:get -> 200 - Response - Body<A1>.x-b-items-3 - Added Extension
1929
/b/:get -> 200 - Response - Body<array[A1]>.x-schema-1 - Deleted Extension
2030
/b/:get -> 200 - Response - Body<array[A1]>.x-schema-2 - Added Extension
31+
/b/:get -> 200 - Response - Body<array[A1]>.x-schema-3 - Changed Extension Value
32+
/b/:post - Request - Body.c.x-ext-param-c - Deleted Extension
33+
/b/:post - Request - FormData.d.x-ext-param-d - Added Extension
34+
/b/:post - Request - Path.b.x-ext-param-b - Added Extension
35+
/b/:post - Request - Query.a.x-ext-param-a - Deleted Extension
36+
/b/:post - Request - Query.a.x-ext-param-a-2 - Changed Extension Value
2137
Security Definitions.x-security-def-2 - Deleted Extension
2238
Security Definitions.x-security-def-3 - Added Extension
39+
Security Definitions.x-security-def-4 - Changed Extension Value
2340
Spec Info.Contact.x-ext-contact-2 - Deleted Extension
2441
Spec Info.Contact.x-ext-contact-3 - Added Extension
42+
Spec Info.Contact.x-ext-contact-4 - Changed Extension Value
2543
Spec Info.License.x-ext-license-2 - Deleted Extension
2644
Spec Info.License.x-ext-license-3 - Added Extension
45+
Spec Info.License.x-ext-license-4 - Changed Extension Value
2746
Spec Info.x-ext-info-2 - Deleted Extension
2847
Spec Info.x-ext-info-3 - Added Extension
2948
Spec Tags.x-ext-tag1 - Added Extension
3049
Spec Tags.x-ext-tag2 - Deleted Extension
3150
Spec.x-root-ext-2 - Deleted Extension
3251
Spec.x-root-ext-3 - Added Extension
52+
Spec.x-root-ext-4 - Changed Extension Value
3353
compatibility test OK. No breaking changes identified.

diff/fixtures/extensions.v1.json

Lines changed: 62 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,62 @@
88
"contact": {
99
"name": "go-swagger",
1010
"x-ext-contact-1": "ext contact 1",
11-
"x-ext-contact-2": "ext contact 2"
11+
"x-ext-contact-2": "ext contact 2",
12+
"x-ext-contact-4": []
1213
},
1314
"license": {
1415
"name": "license",
1516
"x-ext-license-1": "ext license 1",
16-
"x-ext-license-2": "ext license 2"
17+
"x-ext-license-2": "ext license 2",
18+
"x-ext-license-4": 0.5
1719
}
1820
},
1921
"paths": {
2022
"/b/": {
23+
"parameters": [
24+
{
25+
"name": "a",
26+
"in": "query",
27+
"x-ext-param-a": "ext param a",
28+
"x-ext-param-a-2": true
29+
},
30+
{
31+
"name": "b",
32+
"in": "path"
33+
},
34+
{
35+
"name": "c",
36+
"in": "body",
37+
"x-ext-param-c": "ext param c"
38+
},
39+
{
40+
"name": "d",
41+
"in": "header"
42+
},
43+
{
44+
"name": "d",
45+
"in": "formData"
46+
}
47+
],
48+
"post": {
49+
"responses": {
50+
"200": {
51+
"description": "200 response"
52+
}
53+
}
54+
},
2155
"get": {
56+
"parameters": [
57+
{
58+
"name": "limit",
59+
"in": "query",
60+
"x-ext-param-limit": "ext param limit"
61+
},
62+
{
63+
"name": "offset",
64+
"in": "query"
65+
}
66+
],
2267
"responses": {
2368
"200": {
2469
"description": "200 response",
@@ -29,23 +74,28 @@
2974
"x-b-items-1": "b items 1",
3075
"x-b-items-2": "b items 2"
3176
},
32-
"x-schema-1": "schema 1 ext"
77+
"x-schema-1": "schema 1 ext",
78+
"x-schema-3": "schema 3 ext MODIFIED"
3379
},
3480
"headers": {
3581
"headerB-1": {
3682
"type": "integer",
37-
"x-header-ext-1": "header-ext-b-1"
83+
"x-header-ext-1": "header-ext-b-1",
84+
"x-header-ext-3": 1
3885
},
3986
"headerB-2": {
4087
"type": "integer"
4188
}
4289
}
4390
},
44-
"x-ext-resp-1": "response ext 1"
91+
"x-ext-resp-1": "response ext 1",
92+
"x-ext-resp-3": "response ext 3"
4593
},
46-
"x-ext-2-operation": "ext b 2"
94+
"x-ext-2-operation": "ext b 2",
95+
"x-ext-4-operation": 0
4796
},
48-
"x-ext-b-1": "ext b 1"
97+
"x-ext-b-1": "ext b 1",
98+
"x-ext-b-4": {}
4999
}
50100
},
51101
"definitions": {
@@ -85,19 +135,22 @@
85135
},
86136
{
87137
"name": "tag2",
88-
"x-ext-tag2": "ext tag 2"
138+
"x-ext-tag2": "ext tag 2",
139+
"x-ext-tag3": {}
89140
}
90141
],
91142
"securityDefinitions": {
92143
"auth2": {
93144
"x-security-def-1": "ext def 1",
94145
"x-security-def-2": "ext def 2",
146+
"x-security-def-4": {"type": "oauth2"},
95147
"type": "oauth2",
96148
"flow": "accessCode",
97149
"authorizationUrl": "",
98150
"tokenUrl": ""
99151
}
100152
},
101153
"x-root-ext-1": "ext root 1",
102-
"x-root-ext-2": "ext root 2"
154+
"x-root-ext-2": "ext root 2",
155+
"x-root-ext-4": "ext root 4"
103156
}

diff/fixtures/extensions.v2.json

Lines changed: 61 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
"contact": {
99
"name": "go-swagger",
1010
"x-ext-contact-1": "ext contact 1",
11-
"x-ext-contact-3": "ext contact 3"
11+
"x-ext-contact-3": "ext contact 3",
12+
"x-ext-contact-4": [[[]]]
1213
},
1314
"license": {
1415
"name": "license",
1516
"x-ext-license-1": "ext license 1",
16-
"x-ext-license-3": "ext license 3"
17+
"x-ext-license-3": "ext license 3",
18+
"x-ext-license-4": 1
1719
}
1820
},
1921
"paths": {
@@ -31,7 +33,50 @@
3133
}
3234
},
3335
"/b/": {
36+
"parameters": [
37+
{
38+
"name": "a",
39+
"in": "query",
40+
"x-ext-param-a-2": false
41+
},
42+
{
43+
"name": "b",
44+
"in": "path",
45+
"x-ext-param-b": "ext param b"
46+
},
47+
{
48+
"name": "c",
49+
"in": "body"
50+
},
51+
{
52+
"name": "d",
53+
"in": "header"
54+
},
55+
{
56+
"name": "d",
57+
"in": "formData",
58+
"x-ext-param-d": "ext param d"
59+
}
60+
],
61+
"post": {
62+
"responses": {
63+
"200": {
64+
"description": "200 response"
65+
}
66+
}
67+
},
3468
"get": {
69+
"parameters": [
70+
{
71+
"name": "limit",
72+
"in": "query"
73+
},
74+
{
75+
"name": "offset",
76+
"in": "query",
77+
"x-ext-param-offset": "ext param offset"
78+
}
79+
],
3580
"responses": {
3681
"200": {
3782
"description": "200 response",
@@ -42,25 +87,29 @@
4287
"x-b-items-1": "b items 1",
4388
"x-b-items-3": "b items 3"
4489
},
45-
"x-schema-2": "schema 2 ext"
90+
"x-schema-2": "schema 2 ext",
91+
"x-schema-3": "schema 3 ext"
4692
},
4793
"headers": {
4894
"headerB-1": {
49-
"type": "integer"
95+
"type": "integer",
96+
"x-header-ext-3": 2
5097
},
5198
"headerB-2": {
5299
"type": "integer",
53100
"x-header-ext-2": "header-ext-b-2"
54101
}
55102
}
56103
},
57-
"x-ext-resp-2": "response ext 2"
104+
"x-ext-resp-2": "response ext 2",
105+
"x-ext-resp-3": ""
58106
},
59107
"x-ext-1-operation": "ext b 1",
60-
"x-ext-3-operation": "ext b 3"
108+
"x-ext-3-operation": "ext b 3",
109+
"x-ext-4-operation": null
61110
},
62111
"x-ext-b-2": "ext b 2",
63-
"x-ext-b-3": "ext b 3"
112+
"x-ext-b-4": ""
64113
}
65114
},
66115
"definitions": {
@@ -100,19 +149,22 @@
100149
"x-ext-tag1": "ext tag 1"
101150
},
102151
{
103-
"name": "tag2"
152+
"name": "tag2",
153+
"x-ext-tag3": {}
104154
}
105155
],
106156
"securityDefinitions": {
107157
"auth2": {
108158
"x-security-def-1": "ext def 1",
109159
"x-security-def-3": "ext def 3",
160+
"x-security-def-4": {"type": "basic"},
110161
"type": "oauth2",
111162
"flow": "accessCode",
112163
"authorizationUrl": "",
113164
"tokenUrl": ""
114165
}
115166
},
116167
"x-root-ext-1": "ext root 1",
117-
"x-root-ext-3": "ext root 3"
168+
"x-root-ext-3": "ext root 3",
169+
"x-root-ext-4": ["ext root 4 is now an array"]
118170
}

0 commit comments

Comments
 (0)