api-platform / api-platform/core
HeaderParameter constraint-validators receive array value by default
- Linguagem predominante
- PHP
- Estrelas
- 2.6k
- Forks
- 980
- Merge médio
- 2d 5h
- PRs com merge (30d)
- 48
Descrição
**API Platform version(s) affected**: 4.3.17
**Description**
The symfony constraint validators e.g. `Symfony\Component\Validator\Constraints\NotBlankValidator` receive array value by default. Because of that if we pass empty string then validation does not work. Is this a bug or a feature?
**How to reproduce**
```php
parameters: [
'foo' => new HeaderParameter(
required: true,
constraints: [new NotBlank(message: 'foo missing from header')]
),
],
```
**Possible Solution**
```php
parameters: [
'foo' => new HeaderParameter(
required: true,
constraints: [new NotBlank(message: 'foo missing from header')],
nativeType: new BuiltinType(typeIdentifier: TypeIdentifier::STRING)
),
],
```
**Additional Context**
MR to improve doc: https://github.com/api-platform/docs/pull/2322
Guia de contribuição
Avaliação
Esta issue ainda não foi avaliada.