api-platform / api-platform/core
HeaderParameter constraint-validators receive array value by default
- 主要語言
- PHP
- 星號
- 2.6k
- 分支
- 980
- 平均合併
- 2 天 5 小時
- 30 天內合併 PR
- 48
描述
**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
貢獻指南
評估
這個 Issue 還沒有評估資料。