Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

Commit 12d5960

Browse files
committed
test(oas3): test multiple references to same header
1 parent 17cfc6d commit 12d5960

File tree

3 files changed

+264
-3
lines changed

3 files changed

+264
-3
lines changed

packages/fury-adapter-oas3-parser/test/integration/components-test.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,16 @@ describe('components', () => {
4646
return testParseFixture(file);
4747
});
4848

49-
it("'Response Object' headers references", () => {
50-
const file = path.join(fixtures, 'response-object-headers');
51-
return testParseFixture(file);
49+
describe('Response Object', () => {
50+
it('handles headers references', () => {
51+
const file = path.join(fixtures, 'response-object-headers');
52+
return testParseFixture(file);
53+
});
54+
55+
it('handles multiple references to same header', () => {
56+
const file = path.join(fixtures, 'response-object-headers-multiple');
57+
return testParseFixture(file);
58+
});
5259
});
5360

5461
it("'Schema Object' circular references", () => {
Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
{
2+
"element": "parseResult",
3+
"content": [
4+
{
5+
"element": "category",
6+
"meta": {
7+
"classes": {
8+
"element": "array",
9+
"content": [
10+
{
11+
"element": "string",
12+
"content": "api"
13+
}
14+
]
15+
},
16+
"title": {
17+
"element": "string",
18+
"content": "Headers Components"
19+
}
20+
},
21+
"attributes": {
22+
"version": {
23+
"element": "string",
24+
"content": "1.0.0"
25+
}
26+
},
27+
"content": [
28+
{
29+
"element": "resource",
30+
"attributes": {
31+
"href": {
32+
"element": "string",
33+
"content": "/user"
34+
}
35+
},
36+
"content": [
37+
{
38+
"element": "transition",
39+
"meta": {
40+
"title": {
41+
"element": "string",
42+
"content": "View the current User"
43+
}
44+
},
45+
"content": [
46+
{
47+
"element": "httpTransaction",
48+
"content": [
49+
{
50+
"element": "httpRequest",
51+
"attributes": {
52+
"method": {
53+
"element": "string",
54+
"content": "GET"
55+
}
56+
}
57+
},
58+
{
59+
"element": "httpResponse",
60+
"attributes": {
61+
"headers": {
62+
"element": "httpHeaders",
63+
"content": [
64+
{
65+
"element": "member",
66+
"content": {
67+
"key": {
68+
"element": "string",
69+
"content": "X-Rate-Limit-Limit"
70+
},
71+
"value": {
72+
"element": "string"
73+
}
74+
}
75+
}
76+
]
77+
},
78+
"statusCode": {
79+
"element": "string",
80+
"content": "200"
81+
}
82+
},
83+
"content": [
84+
{
85+
"element": "copy",
86+
"content": "hi"
87+
}
88+
]
89+
}
90+
]
91+
}
92+
]
93+
}
94+
]
95+
},
96+
{
97+
"element": "resource",
98+
"attributes": {
99+
"href": {
100+
"element": "string",
101+
"content": "/users"
102+
}
103+
},
104+
"content": [
105+
{
106+
"element": "transition",
107+
"meta": {
108+
"title": {
109+
"element": "string",
110+
"content": "View all users"
111+
}
112+
},
113+
"content": [
114+
{
115+
"element": "httpTransaction",
116+
"content": [
117+
{
118+
"element": "httpRequest",
119+
"attributes": {
120+
"method": {
121+
"element": "string",
122+
"content": "GET"
123+
}
124+
}
125+
},
126+
{
127+
"element": "httpResponse",
128+
"attributes": {
129+
"headers": {
130+
"element": "httpHeaders",
131+
"content": [
132+
{
133+
"element": "member",
134+
"content": {
135+
"key": {
136+
"element": "string",
137+
"content": "X-Rate-Limit-Limit"
138+
},
139+
"value": {
140+
"element": "string"
141+
}
142+
}
143+
}
144+
]
145+
},
146+
"statusCode": {
147+
"element": "string",
148+
"content": "200"
149+
}
150+
},
151+
"content": [
152+
{
153+
"element": "copy",
154+
"content": "hi"
155+
}
156+
]
157+
}
158+
]
159+
}
160+
]
161+
}
162+
]
163+
}
164+
]
165+
},
166+
{
167+
"element": "annotation",
168+
"meta": {
169+
"classes": {
170+
"element": "array",
171+
"content": [
172+
{
173+
"element": "string",
174+
"content": "warning"
175+
}
176+
]
177+
}
178+
},
179+
"attributes": {
180+
"sourceMap": {
181+
"element": "array",
182+
"content": [
183+
{
184+
"element": "sourceMap",
185+
"content": [
186+
{
187+
"element": "array",
188+
"content": [
189+
{
190+
"element": "number",
191+
"attributes": {
192+
"line": {
193+
"element": "number",
194+
"content": 27
195+
},
196+
"column": {
197+
"element": "number",
198+
"content": 7
199+
}
200+
},
201+
"content": 572
202+
},
203+
{
204+
"element": "number",
205+
"attributes": {
206+
"line": {
207+
"element": "number",
208+
"content": 27
209+
},
210+
"column": {
211+
"element": "number",
212+
"content": 18
213+
}
214+
},
215+
"content": 11
216+
}
217+
]
218+
}
219+
]
220+
}
221+
]
222+
}
223+
},
224+
"content": "'Header Object' contains unsupported key 'description'"
225+
}
226+
]
227+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
openapi: 3.0.0
2+
info:
3+
version: 1.0.0
4+
title: Headers Components
5+
paths:
6+
/user:
7+
get:
8+
summary: View the current User
9+
responses:
10+
'200':
11+
description: hi
12+
headers:
13+
X-Rate-Limit-Limit:
14+
$ref: '#/components/headers/X-Rate-Limit-Limit'
15+
/users:
16+
get:
17+
summary: View all users
18+
responses:
19+
'200':
20+
description: hi
21+
headers:
22+
X-Rate-Limit-Limit:
23+
$ref: '#/components/headers/X-Rate-Limit-Limit'
24+
components:
25+
headers:
26+
X-Rate-Limit-Limit:
27+
description: The number of allowed requests in the current period

0 commit comments

Comments
 (0)