Skip to content

Commit 8c16f1b

Browse files
committed
Fixed spec parser
1 parent a2223ab commit 8c16f1b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/Spec/Swagger2.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,6 @@ public function getMethods($service)
180180

181181
$param['default'] = (is_array($param['default'])) ? json_encode($param['default']): $param['default'];
182182

183-
$output['parameters']['all'][] = $param;
184-
185183
switch ($parameter['in']) {
186184
case 'header':
187185
$output['parameters']['header'][] = $param;
@@ -196,8 +194,8 @@ public function getMethods($service)
196194
$output['parameters']['body'][] = $param;
197195
break;
198196
case 'body':
199-
$bodyProperties = $param['schema']['properties'] ?? [];
200-
$bodyRequired = $param['schema']['required'] ?? [];
197+
$bodyProperties = $parameter['schema']['properties'] ?? [];
198+
$bodyRequired = $parameter['schema']['required'] ?? [];
201199

202200
foreach ($bodyProperties as $key => $value) {
203201
$param['name'] = $key;
@@ -208,10 +206,15 @@ public function getMethods($service)
208206
$param['example'] = $value['x-example'] ?? null;
209207

210208
$output['parameters']['body'][] = $param;
209+
$output['parameters']['all'][] = $param;
211210
}
211+
212+
continue 2;
212213

213214
break;
214215
}
216+
217+
$output['parameters']['all'][] = $param;
215218
}
216219

217220
usort($output['parameters']['all'], function ($a, $b) {

0 commit comments

Comments
 (0)