Skip to content

Commit

Permalink
solve issue ovac#39
Browse files Browse the repository at this point in the history
  • Loading branch information
apriliaan committed Jul 17, 2023
1 parent 91ee702 commit 4351571
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions src/idoc/IDocGeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,23 +324,21 @@ function ($parameter) {
->toArray()
),

'responses' => [
200 => [
'description' => 'success',
] +
(
count($route['response'] ?? [])
? ['content' => [
'application/json' => [
'schema' => [
'type' => 'object',
'example' => json_decode($route['response'][0]['content'], true),
],
],
]]
: []
),
],
'responses' => collect($route['response'])->mapWithKeys(function($item) {
return [
(int) $item['status'] => [
'description' => in_array($item['status'], range(200,299)) ? 'success' : 'error',
'content' => [
'application/json' => [
'schema' => [
'type' => 'object',
'example' => json_decode($item['content'])
]
]
]
]
];
})->all(),

'x-code-samples' => collect(config('idoc.language-tabs'))->map(function ($name, $lang) use ($route) {
return [
Expand Down Expand Up @@ -377,7 +375,7 @@ function ($parameter) {
'description' => config('idoc.description'),
'termsOfService' => config('idoc.terms_of_service'),
"license" => !empty(config('idoc.license')) ? config('idoc.license') : null,
"contact" => config('idoc.contact'),
"contact" => config('idoc.contact'),
"x-logo" => [
"url" => config('idoc.logo'),
"altText" => config('idoc.title'),
Expand Down

0 comments on commit 4351571

Please # to comment.