API Platform version(s) affected: 2.6.x
Description
The new OpenApi implementation is really nice !
It just seems the explode attributes of Model\Parameters is not right normalized :
|
public function canExplode(): bool |
|
{ |
|
return $this->explode; |
|
} |
Replacing by getExplode make it displaying in the swagger ui.
And moreover, it cannot be overriden
|
$parameters[] = new Model\Parameter( |
|
$name, |
|
'query', |
|
$data['description'] ?? '', |
|
$data['required'] ?? false, |
|
$data['openapi']['deprecated'] ?? false, |
|
$data['openapi']['allowEmptyValue'] ?? true, |
|
$schema, |
|
'array' === $schema['type'] && \in_array($data['type'], |
|
[Type::BUILTIN_TYPE_ARRAY, Type::BUILTIN_TYPE_OBJECT], true) ? 'deepObject' : 'form', |
|
'array' === $schema['type'], |
|
$data['openapi']['allowReserved'] ?? false, |
|
$data['openapi']['example'] ?? null, |
|
isset($data['openapi']['examples'] |
|
) ? new \ArrayObject($data['openapi']['examples']) : null); |
What about something like :
$parameters[] = new Model\Parameter(
$name,
'query',
$data['description'] ?? '',
$data['required'] ?? false,
$data['openapi']['deprecated'] ?? false,
$data['openapi']['allowEmptyValue'] ?? true,
$schema,
'array' === $schema['type'] && \in_array($data['type'],
[Type::BUILTIN_TYPE_ARRAY, Type::BUILTIN_TYPE_OBJECT], true) ? 'deepObject' : 'form',
$data['openapi']['explode'] ?? ('array' === $schema['type']),
$data['openapi']['allowReserved'] ?? false,
$data['openapi']['example'] ?? null,
isset($data['openapi']['examples']
) ? new \ArrayObject($data['openapi']['examples']) : null);
How to reproduce
Just drop a filter and watch the swagger-data in the swagger ui.
Possible Solution
Not sure if both suggestion are the best. But if we think they are, I'm open to make a PR.
API Platform version(s) affected: 2.6.x
Description
The new OpenApi implementation is really nice !
It just seems the
explodeattributes ofModel\Parametersis not right normalized :core/src/OpenApi/Model/Parameter.php
Lines 101 to 104 in 4717bd5
Replacing by
getExplodemake it displaying in the swagger ui.And moreover, it cannot be overriden
core/src/OpenApi/Factory/OpenApiFactory.php
Lines 383 to 397 in 4717bd5
What about something like :
How to reproduce
Just drop a filter and watch the swagger-data in the swagger ui.
Possible Solution
Not sure if both suggestion are the best. But if we think they are, I'm open to make a PR.