[OpenAPI] Allow using (more) objects instead of arrays in openapiContext
Description
Hello! I'm in the middle of transforming my old API to the API Platform one.
One thing I noticed is that when changing OpenAPI attributes to Api Platform attributes I can no longer use item references as class names or generally OpenAPI/Nelmio Model objects deeper under openapiContext property.
Am I missing something to make it work properly or is this feature not implemented yet?
Example
My old attribute:
use OpenApi\Attributes as OA;
use Nelmio\ApiDocBundle\Annotation\Model;
#[OA\Property(
description: 'the list of order items',
type: 'array',
items: new OA\Items(
ref: new Model(type: OrderItem::class),
)
)]
public array $items;
The new one:
#[ApiProperty(
description: 'the list of order items',
openapiContext: [
'type' => 'array',
'items' => [
'$ref' => '#/components/schemas/OrderItem'
],
],
)]
public array $items;
I wish it'd be something like:
#[ApiProperty(openapi: new Schema)]
from where do use OpenApi\Attributes as OA; come from?
@soyuka they come from https://github.com/zircote/swagger-php through https://github.com/nelmio/NelmioApiDocBundle
Sorry we're not compatible with swagger-php for now it's not supported, marking this as an enhancement.