Skip to content

Commit 9acecc8

Browse files
committed
Failing test
1 parent db98ac8 commit 9acecc8

File tree

4 files changed

+132
-7
lines changed

4 files changed

+132
-7
lines changed

compiled.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
openapi: 3.0.0
2+
info:
3+
title: 'Test REST API'
4+
description: 'Specifications for the Test REST API.'
5+
contact:
6+
name: bplainia
7+
8+
version: '2021-05-18'
9+
servers:
10+
-
11+
url: 'http://localhost:8000'
12+
description: Test
13+
paths:
14+
'/v1/organizations/{organizationId}/user':
15+
post:
16+
summary: 'Creates a user'
17+
requestBody:
18+
content:
19+
application/json:
20+
schema:
21+
type: object
22+
properties:
23+
data:
24+
type: object
25+
properties:
26+
id:
27+
type: string
28+
format: uuid
29+
name:
30+
type: string
31+
required: true
32+
responses:
33+
'201':
34+
description: Created
35+
content:
36+
application/json:
37+
schema:
38+
type: object
39+
properties:
40+
data:
41+
type: object
42+
properties:
43+
id:
44+
type: string
45+
format: uuid
46+
name:
47+
type: string
48+
'400':
49+
description: 'Bad Request'
50+
'403':
51+
description: Forbidden
52+
security:
53+
-
54+
BearerAuth: []
55+
parameters:
56+
- name: organizationId
57+
in: path
58+
description: 'The Organization ID'
59+
required: true
60+
schema:
61+
type: string
62+
format: uuid
63+
- name: api-version
64+
in: header
65+
description: 'The API version'
66+
required: false
67+
schema:
68+
type: string
69+
format: date
70+
example: '2021-05-18'
71+
'/v1/organizations/{organizationId}/user/{id}':
72+
get:
73+
summary: 'Gets a user'
74+
responses:
75+
'200':
76+
description: hi there
77+
content:
78+
application/json:
79+
schema:
80+
type: object
81+
properties:
82+
data:
83+
type: object
84+
properties:
85+
id:
86+
type: string
87+
format: uuid
88+
name:
89+
type: string
90+
'400':
91+
description: 'Bad Request'
92+
'403':
93+
description: Forbidden
94+
'404':
95+
description: 'Not Found'
96+
security:
97+
-
98+
BearerAuth: []
99+
parameters:
100+
-
101+
name: organizationId
102+
in: path
103+
description: 'The Organization ID'
104+
required: true
105+
schema:
106+
type: string
107+
format: uuid
108+
-
109+
name: api-version
110+
in: header
111+
description: 'The API version'
112+
required: false
113+
schema:
114+
type: string
115+
format: date
116+
example: '2021-05-18'
117+
-
118+
name: id
119+
in: path
120+
description: 'User''s ID'
121+
required: true
122+
schema:
123+
type: string
124+
format: uuid

tests/spec/PathTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ public function testPathParametersAreArrays()
205205

206206
$this->assertInstanceOf(Paths::class, $openapi->paths);
207207
$this->assertIsArray($openapi->paths->getPaths());
208-
$this->assertInstanceOf(PathItem::class, $usersPath = $openapi->paths['/v1/{organizationId}/user']);
209-
$this->assertInstanceOf(PathItem::class, $userIdPath = $openapi->paths['/v1/{organizationId}/user/{id}']);
208+
$this->assertInstanceOf(PathItem::class, $usersPath = $openapi->paths['/v1/organizations/{organizationId}/user']);
209+
$this->assertInstanceOf(PathItem::class, $userIdPath = $openapi->paths['/v1/organizations/{organizationId}/user/{id}']);
210210

211211
$result = $usersPath->validate();
212212
$this->assertTrue($result);
@@ -220,7 +220,7 @@ public function testPathParametersAreArrays()
220220
$this->assertIsArray($userIdPath->parameters);
221221
$this->assertInstanceOf(\cebe\openapi\spec\Parameter::class, $userIdPath->parameters[0]);
222222
$this->assertInstanceOf(\cebe\openapi\spec\Parameter::class, $userIdPath->parameters[1]);
223-
$this->assertEquals($userIdPath->parameters[2]->name, 'id');
223+
$this->assertEquals($userIdPath->parameters[2]->name, 'id');
224224

225225
}
226226
}

tests/spec/data/path-params/openapi.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ servers:
1111
- url: 'http://localhost:8000'
1212
description: 'Test'
1313

14-
paths:
15-
/v1/{organizationId}/user:
14+
paths:
15+
/v1/organizations/{organizationId}/user:
1616
$ref: 'user.yaml#/paths/Users'
17-
/v1/{organizationId}/user/{id}:
17+
/v1/organizations/{organizationId}/user/{id}:
1818
$ref: 'user.yaml#/paths/UserId'

tests/spec/data/path-params/user.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
paths:
23
Users:
34
parameters:
@@ -73,4 +74,4 @@ components:
7374
schema:
7475
type: string
7576
format: uuid
76-
description: User's ID
77+
description: User's ID

0 commit comments

Comments
 (0)