Skip to content

[Filter] documention of enums on custom filters doesn't work anymore #8011

Description

@remoteclient

API Platform version(s) affected: 2.5.9

Description
Given is this definition in a custom filter:

    public function getDescription(string $resourceClass): array
    {
        if (!$this->properties) {
            return [];
        }

        $description = [];
        foreach ($this->properties as $property => $strategy) {
            $description[$property] = [
                'property' => $property,
                'type' => 'string',
                'required' => false,
                'openapi' => [
                    'description' => 'Filter leads by state',
                    'name' => 'LeadStateFilter',
                    'type' => 'string',
                    'enum' => ['new', 'archived', 'anonymized'],
                ],
            ];
        }

        return $description;
    }

The enum isn't showing up on swagger anymore. This used to work in the past. I did not realize when it stopped working.

How to reproduce
Try setting an enum like above in a custom filter description.

Metadata

Metadata

Assignees

No one assigned

    Labels

    OpenAPIfiltersAPI filters (Search/Numeric/Order/Date/Range)

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions