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

Commit c8f2cf8

Browse files
committed
test(oas3): test multiple references to same response
1 parent 12d5960 commit c8f2cf8

File tree

3 files changed

+246
-11
lines changed

3 files changed

+246
-11
lines changed

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

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,26 @@ describe('components', () => {
3131
return testParseFixture(file);
3232
});
3333

34-
it("'Responses Object' response references", () => {
35-
const file = path.join(fixtures, 'responses-object-response');
36-
return testParseFixture(file);
37-
});
34+
describe('Responses Object', () => {
35+
it('handles response references', () => {
36+
const file = path.join(fixtures, 'responses-object-response');
37+
return testParseFixture(file);
38+
});
3839

39-
it("'Responses Object' response references with schema", () => {
40-
const file = path.join(fixtures, 'responses-object-response-with-schema');
41-
return testParseFixture(file);
42-
});
40+
it('handles multiple references to same response', () => {
41+
const file = path.join(fixtures, 'responses-object-response-multiple');
42+
return testParseFixture(file);
43+
});
4344

44-
it("'Responses Object' respomnse references with headers", () => {
45-
const file = path.join(fixtures, 'responses-object-response-with-headers');
46-
return testParseFixture(file);
45+
it('handles response references with schema', () => {
46+
const file = path.join(fixtures, 'responses-object-response-with-schema');
47+
return testParseFixture(file);
48+
});
49+
50+
it('handles responses references with headers', () => {
51+
const file = path.join(fixtures, 'responses-object-response-with-headers');
52+
return testParseFixture(file);
53+
});
4754
});
4855

4956
describe('Response Object', () => {
Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
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": "Response Components with Headers"
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": "226"
81+
}
82+
},
83+
"content": [
84+
{
85+
"element": "copy",
86+
"content": "A user"
87+
}
88+
]
89+
}
90+
]
91+
},
92+
{
93+
"element": "httpTransaction",
94+
"content": [
95+
{
96+
"element": "httpRequest",
97+
"attributes": {
98+
"method": {
99+
"element": "string",
100+
"content": "GET"
101+
}
102+
}
103+
},
104+
{
105+
"element": "httpResponse",
106+
"attributes": {
107+
"headers": {
108+
"element": "httpHeaders",
109+
"content": [
110+
{
111+
"element": "member",
112+
"content": {
113+
"key": {
114+
"element": "string",
115+
"content": "X-Rate-Limit-Limit"
116+
},
117+
"value": {
118+
"element": "string"
119+
}
120+
}
121+
}
122+
]
123+
},
124+
"statusCode": {
125+
"element": "string",
126+
"content": "226"
127+
}
128+
},
129+
"content": [
130+
{
131+
"element": "copy",
132+
"content": "A user"
133+
}
134+
]
135+
}
136+
]
137+
}
138+
]
139+
}
140+
]
141+
}
142+
]
143+
},
144+
{
145+
"element": "annotation",
146+
"meta": {
147+
"classes": {
148+
"element": "array",
149+
"content": [
150+
{
151+
"element": "string",
152+
"content": "warning"
153+
}
154+
]
155+
}
156+
},
157+
"attributes": {
158+
"sourceMap": {
159+
"element": "array",
160+
"content": [
161+
{
162+
"element": "sourceMap",
163+
"content": [
164+
{
165+
"element": "array",
166+
"content": [
167+
{
168+
"element": "number",
169+
"attributes": {
170+
"line": {
171+
"element": "number",
172+
"content": 23
173+
},
174+
"column": {
175+
"element": "number",
176+
"content": 7
177+
}
178+
},
179+
"content": 508
180+
},
181+
{
182+
"element": "number",
183+
"attributes": {
184+
"line": {
185+
"element": "number",
186+
"content": 23
187+
},
188+
"column": {
189+
"element": "number",
190+
"content": 18
191+
}
192+
},
193+
"content": 11
194+
}
195+
]
196+
}
197+
]
198+
}
199+
]
200+
}
201+
},
202+
"content": "'Header Object' contains unsupported key 'description'"
203+
}
204+
]
205+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
openapi: 3.0.0
2+
info:
3+
version: 1.0.0
4+
title: Response Components with Headers
5+
paths:
6+
/user:
7+
get:
8+
summary: View the current User
9+
responses:
10+
'200':
11+
$ref: '#/components/responses/UserResponse'
12+
'226':
13+
$ref: '#/components/responses/UserResponse'
14+
components:
15+
responses:
16+
UserResponse:
17+
description: A user
18+
headers:
19+
X-Rate-Limit-Limit:
20+
$ref: '#/components/headers/X-Rate-Limit-Limit'
21+
headers:
22+
X-Rate-Limit-Limit:
23+
description: The number of allowed requests in the current period

0 commit comments

Comments
 (0)