| 1 |
<?php declare(strict_types=1); |
| 2 |
|
| 3 |
/** |
| 4 |
* @license Apache 2.0 |
| 5 |
*/ |
| 6 |
|
| 7 |
namespace OpenApi\Processors; |
| 8 |
|
| 9 |
use OpenApi\Analysis; |
| 10 |
use OpenApi\Annotations as OA; |
| 11 |
use OpenApi\Context; |
| 12 |
|
| 13 |
/** |
| 14 |
* Use the Schema context to extract useful information and inject that into the annotation. |
| 15 |
* |
| 16 |
* Merges properties. |
| 17 |
*/ |
| 18 |
class AugmentItems |
| 19 |
{ |
| 20 |
public function __invoke(Analysis $analysis): void |
| 21 |
{ |
| 22 |
$schemas = $analysis->getAnnotationsOfType(OA\Schema::class); |
| 23 |
|
| 24 |
foreach ($schemas as $schema) { |
| 25 |
if ($schema->items instanceof OA\Items) { |
| 26 |
$schema->type = 'array'; |
| 27 |
} |
| 28 |
} |
| 29 |
} |
| 30 |
} |