You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 <[email protected]>
Copy file name to clipboardExpand all lines: sources/platform/api_v2/api_v2_reference.apib
+36-3Lines changed: 36 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -3081,6 +3081,9 @@ The POST payload is a JSON object or a JSON array of objects to save into the da
3081
3081
**IMPORTANT:** The limit of request payload size for the dataset is 5 MB. If the array exceeds the size,
3082
3082
you'll need to split it into a number of smaller arrays.
3083
3083
3084
+
If the dataset has fields schema defined, the push request can potentialy fail with `400 Bad Request` if any item does not match the schema.
3085
+
In such case, nothing will be inserted into the dataset and the response will contain an error message with a list of invalid items and their validation errors.
3086
+
3084
3087
+ Parameters
3085
3088
3086
3089
+ token: `soSkq9ekdmfOslopH` (string, required) - API authentication token.
@@ -3099,9 +3102,6 @@ you'll need to split it into a number of smaller arrays.
3099
3102
},
3100
3103
{
3101
3104
"foo": "hotel"
3102
-
},
3103
-
{
3104
-
"foo": "restaurant"
3105
3105
}
3106
3106
]
3107
3107
@@ -3113,6 +3113,39 @@ you'll need to split it into a number of smaller arrays.
0 commit comments