core icon indicating copy to clipboard operation
core copied to clipboard

'openapi' key doesn't work in getDescription method ApiPlatform\Doctrine\Orm\Filter\FilterInterface

Open mikec655 opened this issue 1 year ago • 1 comments

API Platform version(s) affected: 3.2.19

Description

    {
        return [
            self::PROPERTY_NAME => [
                'property' => self::PROPERTY_NAME ,
                'type' => Type::BUILTIN_TYPE_ARRAY,
                'required' => false,
                'openapi' => [
                    'name' => self::PROPERTY_NAME,
                    'schema' => [
                        'type' => 'array',
                        'item' => [
                            'type' => 'string'
                        ]
                    ],
                ],
            ],
        ];
    }

In the above code anything in the 'openapi' is not shown in the openapi docs.

    {
        return [
            self::PROPERTY_NAME => [
                'property' => self::PROPERTY_NAME,
                'type' => Type::BUILTIN_TYPE_ARRAY,
                'required' => false,
                'schema' => [
                    'type' => 'array',
                    'items' => [
                        'type' => 'string'
                    ]
                ],
            ],
        ];
    }

But placing the properties outside of 'openapi' does change the openapi docs. This is against what the ApiPlatfrom docs says on this page: https://api-platform.com/docs/core/filters/.

How to reproduce

  1. Create a custom filter implementing interface ApiPlatform\Doctrine\Orm\Filter\FilterInterface
  2. Implement the getDescription method like the two examples above
  3. See the first example doesn't work, but the second does

mikec655 avatar May 06 '24 13:05 mikec655

https://github.com/api-platform/core/blob/main/src/OpenApi/Factory/OpenApiFactory.php#L636

soyuka avatar May 07 '24 10:05 soyuka

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 06 '24 13:07 stale[bot]