Skip to content

Commit b57d332

Browse files
gabrielius914dunglas
authored andcommitted
patch(filters) fix openapi property in custom filter documentation
1 parent ebd8fad commit b57d332

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

core/filters.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,6 +1534,7 @@ use ApiPlatform\Doctrine\Orm\Util\QueryNameGeneratorInterface;
15341534
use ApiPlatform\Metadata\Operation;
15351535
use Doctrine\ORM\QueryBuilder;
15361536
use Symfony\Component\PropertyInfo\Type;
1537+
use ApiPlatform\OpenApi\Model\Parameter;
15371538
15381539
final class RegexpFilter extends AbstractFilter
15391540
{
@@ -1567,12 +1568,14 @@ final class RegexpFilter extends AbstractFilter
15671568
'type' => Type::BUILTIN_TYPE_STRING,
15681569
'required' => false,
15691570
'description' => 'Filter using a regex. This will appear in the OpenApi documentation!',
1570-
'openapi' => [
1571-
'example' => 'Custom example that will be in the documentation and be the default value of the sandbox',
1572-
'allowReserved' => false,// if true, query parameters will be not percent-encoded
1573-
'allowEmptyValue' => true,
1574-
'explode' => false, // to be true, the type must be Type::BUILTIN_TYPE_ARRAY, ?product=blue,green will be ?product=blue&product=green
1575-
],
1571+
'openapi' => new Parameter(
1572+
name: $property,
1573+
in: 'query',
1574+
allowEmptyValue: true,
1575+
explode: false, // to be true, the type must be Type::BUILTIN_TYPE_ARRAY, ?product=blue,green will be ?product=blue&product=green
1576+
allowReserved: false, // if true, query parameters will be not percent-encoded
1577+
example: 'Custom example that will be in the documentation and be the default value of the sandbox',
1578+
),
15761579
];
15771580
}
15781581

0 commit comments

Comments
 (0)