Skip to content

Issue with docs generation for array of strings #7468

@rvanlaak

Description

@rvanlaak

API Platform version(s) affected: 4.2.2 (after having updated from 4.1.23)

Description

The JSON LD schema of a resource's simple output DTO seems to now consider an array of strings as null[] where it was string[] on APIP 4.1.23

Image

How to reproduce

We use openapi-typescript to transform API Platform's documentation to types:

npx openapi-typescript "https://${SERVER_NAME}/docs.jsonopenapi" -o ./pwa/types/api-schema.d.ts

Possible Solution

Additional Context

The introduction of the HydraItemsBase of #7426 through #7444 is great. Could it have affected anything else?

DTO Shape:

<?php

namespace App\Domain\Shared\Specification;

use Symfony\Component\Serializer\Attribute\Groups;

#[Groups('me:read')]
final readonly class SpecificationResult
{
    private function __construct(
        public bool $passed,

        /**
         * @var list<non-empty-string>
         */
        public array $messages = [],
    ) {
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions