since example

$humanReadableName = $this->convertToHumanReadable($definition->getEntityName());
        $tags = [$humanReadableName];

        if ($experimental = $this->isExperimental($definition)) {
            $tags[] = 'Experimental';
        }

        $schemaName = $this->snakeCaseToCamelCase($definition->getEntityName());

        return new Get([
            'summary' => 'List with basic information of ' . $humanReadableName . ' resources.' . ($experimental ? ' Experimental API, not part of our backwards compatibility promise, thus this API can introduce breaking changes at any time.' : ''),
            'description' => $definition->since() ? 'Available since: ' . $definition->since() : '',
            'tags' => $tags,
            'parameters' => $this->getDefaultListingParameter(),
            'operationId' => 'get' . $this->convertToOperationId($definition->getEntityName()) . 'List',
            'responses' => [
                Response::HTTP_OK => new OpenApiResponse([
                    'response' => Response::HTTP_OK,
                    'description' => 'List of ' . $humanReadableName . ' resources.',
                    'content' => [
                        'application/vnd.api+json' => [
                            'schema' => [
                                'allOf' => [
                                    [
$schema[$schemaName . 'JsonApi'] = new Schema([
                'schema' => $schemaName . 'JsonApi',
                'allOf' => [
                    new Schema(['ref' => '#/components/schemas/resource']),
                    new Schema([
                        'type' => 'object',
                        'properties' => $attributes,
                    ]),
                ],
            ]);

            if (!empty($definition->since())) {
                $schema[$schemaName . 'JsonApi']->description = 'Added since version: ' . $definition->since();
            }

            if (\count($requiredAttributes)) {
                $schema[$schemaName . 'JsonApi']->allOf[1]->required = $requiredAttributes;
            }

            if (\count($relationships)) {
                $schema[$schemaName . 'JsonApi']->allOf[1]->properties[] = new Property([
                    'property' => 'relationships',
                    'type' => 'object',
                    
class EntityDefinitionHasSinceTest extends TestCase
{
    use KernelTestBehaviour;

    public function testAllDefinitionsHasSince(): void
    {
        $service = $this->getContainer()->get(DefinitionInstanceRegistry::class);

        $definitionsWithoutSince = [];

        foreach ($service->getDefinitions() as $definition) {
            if ($definition->since() === null) {
                $definitionsWithoutSince[] = $definition->getEntityName();
            }
        }

        static::assertCount(0, $definitionsWithoutSincesprintf('Following definitions does not have a since version: %s', implode(',', $definitionsWithoutSince)));
    }
}
Home | Imprint | This part of the site doesn't use cookies.