I don’t find how to reusing schema for open api when I used the ModelOperation class in openapi attribute.
For example below (in resource class in php with native attributes):
new GetCollection(
uriTemplate: '/books',
openapi: new ModelOperation(
responses: [
'200' => [
'description' => 'Get a collection of Book resources',
'content' => [
'application/ld+json' => [
'schema' => [
'type' => 'object',
'properties' => [
'@context' => ['type' => 'string'],
'@id' => ['type' => 'string'],
'@type' => ['type' => 'integer'],
'hydra:totalItem' => ['type' => 'integer'],
'hydra:member' => [
'type' => 'array',
'items' => [
'type' => 'object',
'properties' => [
'id' => ['type' => 'string'],
'title' => ['type' => 'string'],
],
],
],
],
],
],
],
],
],
summary: 'Retrieve a collection of Book resources',
description: 'Retrieve a collection of Book resources'
),
),
If I need this schema in another resource, how do I ?
Thanks.
I try to add schemas index like openapi documentation https://learn.openapis.org/specification/components.html but it not works.