@@ -324,23 +324,21 @@ function ($parameter) {
324324 ->toArray ()
325325 ),
326326
327- 'responses ' => [
328- 200 => [
329- 'description ' => 'success ' ,
330- ] +
331- (
332- count ($ route ['response ' ] ?? [])
333- ? ['content ' => [
334- 'application/json ' => [
335- 'schema ' => [
336- 'type ' => 'object ' ,
337- 'example ' => json_decode ($ route ['response ' ][0 ]['content ' ], true ),
338- ],
339- ],
340- ]]
341- : []
342- ),
343- ],
327+ 'responses ' => collect ($ route ['response ' ])->mapWithKeys (function ($ item ) {
328+ return [
329+ (int ) $ item ['status ' ] => [
330+ 'description ' => in_array ($ item ['status ' ], range (200 ,299 )) ? 'success ' : 'error ' ,
331+ 'content ' => [
332+ 'application/json ' => [
333+ 'schema ' => [
334+ 'type ' => 'object ' ,
335+ 'example ' => json_decode ($ item ['content ' ])
336+ ]
337+ ]
338+ ]
339+ ]
340+ ];
341+ })->all (),
344342
345343 'x-code-samples ' => collect (config ('idoc.language-tabs ' ))->map (function ($ name , $ lang ) use ($ route ) {
346344 return [
@@ -377,7 +375,7 @@ function ($parameter) {
377375 'description ' => config ('idoc.description ' ),
378376 'termsOfService ' => config ('idoc.terms_of_service ' ),
379377 "license " => !empty (config ('idoc.license ' )) ? config ('idoc.license ' ) : null ,
380- "contact " => config ('idoc.contact ' ),
378+ "contact " => config ('idoc.contact ' ),
381379 "x-logo " => [
382380 "url " => config ('idoc.logo ' ),
383381 "altText " => config ('idoc.title ' ),
0 commit comments