|
7 | 7 |
|
8 | 8 | - Request data supported: `json`, `xml` and `form` based on header content type.
|
9 | 9 | - Resolve inputs arguments for controllers actions.
|
10 |
| -- Validate DTO inputs objects (An option to enable or disable it). |
11 |
| -- Global YAML configuration |
12 |
| -- Custom Configuration via Input Attribute per controller action |
| 10 | +- Validate DTO inputs objects. |
| 11 | +- Global YAML configuration. |
| 12 | +- Custom Configuration via Input Attribute per controller action. |
13 | 13 |
|
14 | 14 | ### Installation
|
15 | 15 | Require the bundle with composer:
|
@@ -86,17 +86,45 @@ Content-Type: application/problem+json; charset=utf-8
|
86 | 86 | }
|
87 | 87 | ```
|
88 | 88 |
|
| 89 | +### Deserialization (v1.2.2) |
| 90 | + |
| 91 | +Whether the request data contains invalid syntax or invalid attributes types a clear 400 json response will return: |
| 92 | + |
| 93 | +- Data Error |
| 94 | + |
| 95 | +```json |
| 96 | +{ |
| 97 | + "title": "Deserialization Failed", |
| 98 | + "detail": "Data error", |
| 99 | + "violations": [ |
| 100 | + { |
| 101 | + "propertyPath": "title", |
| 102 | + "message": "This value should be of type string", |
| 103 | + "currentType": "int" |
| 104 | + } |
| 105 | + ] |
| 106 | +} |
| 107 | +``` |
| 108 | +- Syntax error: |
| 109 | +```json |
| 110 | +{ |
| 111 | + "title": "Deserialization Failed", |
| 112 | + "detail": "Syntax error", |
| 113 | + "violations": [] |
| 114 | +} |
| 115 | +``` |
| 116 | + |
89 | 117 | ### Configuration
|
90 |
| -* In case you want to serve a specific input data format for all your DTO inputs with skip validation: |
| 118 | + |
91 | 119 | ```yaml
|
92 | 120 | # config/packages/request_input.yaml
|
93 | 121 | request_input:
|
94 | 122 | enabled: true # default value true
|
95 | 123 | formats: ['json'] # default value ['json', 'xml', 'form']
|
96 | 124 | skip_validation: true # default value false
|
97 | 125 | ```
|
98 |
| -- With above configuration RequestInputBundle will convert JSON request data only and skip validation process. |
99 |
| -- You can also use a format even if disabled globally by using attribute input and specify the format explicitly. |
| 126 | +
|
| 127 | +You can also override the format using attribute input and specify the format explicitly. |
100 | 128 |
|
101 | 129 | ## License
|
102 | 130 |
|
|
0 commit comments