Commit dd54e3b
feat: add API documentation for dataset validation (#1079)
Hey all, this is a proposal of how the dataset validation could be
handled in API.
We have decided, that no matter how many items in a request you send, if
at least one is not valid the whole request fails with `400 Bad
request`.
My proposal is to return our normal API error, but add "data" property
to the error object returned from API and in the data return
"invalidItems" which will list all validation errors for all invalid
items by index in the items array.
So for example if you send a request with 1000 items and 2 of them do
not have a required field. The response will look like this:
```json
{
"error": {
"type": "schema-validation-error",
"message": "Schema validation failed",
"data": {
"invalidItems": {
"4": ["name is required"],
"124": ["name is required"],
},
}
}
}
```
---------
Co-authored-by: Jaroslav Hejlek <jarda@hejlek.cz>1 parent e38d9a3 commit dd54e3b
1 file changed
+36
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3081 | 3081 | | |
3082 | 3082 | | |
3083 | 3083 | | |
| 3084 | + | |
| 3085 | + | |
| 3086 | + | |
3084 | 3087 | | |
3085 | 3088 | | |
3086 | 3089 | | |
| |||
3099 | 3102 | | |
3100 | 3103 | | |
3101 | 3104 | | |
3102 | | - | |
3103 | | - | |
3104 | | - | |
3105 | 3105 | | |
3106 | 3106 | | |
3107 | 3107 | | |
| |||
3113 | 3113 | | |
3114 | 3114 | | |
3115 | 3115 | | |
| 3116 | + | |
| 3117 | + | |
| 3118 | + | |
| 3119 | + | |
| 3120 | + | |
| 3121 | + | |
| 3122 | + | |
| 3123 | + | |
| 3124 | + | |
| 3125 | + | |
| 3126 | + | |
| 3127 | + | |
| 3128 | + | |
| 3129 | + | |
| 3130 | + | |
| 3131 | + | |
| 3132 | + | |
| 3133 | + | |
| 3134 | + | |
| 3135 | + | |
| 3136 | + | |
| 3137 | + | |
| 3138 | + | |
| 3139 | + | |
| 3140 | + | |
| 3141 | + | |
| 3142 | + | |
| 3143 | + | |
| 3144 | + | |
| 3145 | + | |
| 3146 | + | |
| 3147 | + | |
| 3148 | + | |
3116 | 3149 | | |
3117 | 3150 | | |
3118 | 3151 | | |
| |||
0 commit comments