Skip to content

Commit 4fb5eaf

Browse files
committed
add info to api docs
1 parent dc6329e commit 4fb5eaf

File tree

4 files changed

+86
-30
lines changed

4 files changed

+86
-30
lines changed

apify-api/openapi/components/schemas/datasets/CreateDatasetResponseError.yaml renamed to apify-api/openapi/components/schemas/datasets/PutItemResponseError.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
title: Createdatasetresponseerror
1+
title: PutItemResponseError
22
required:
33
- error
44
type: object
Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,53 @@
1-
title: error
2-
required:
3-
- type
4-
- message
51
type: object
62
properties:
7-
type:
8-
type: string
9-
example: schema-validation-error
10-
message:
11-
type: string
12-
example: 'Schema validation failed'
3+
error:
4+
type: object
5+
properties:
6+
type:
7+
type: string
8+
description: The type of the error.
9+
example: "schema-validation-error"
10+
message:
11+
type: string
12+
description: A human-readable message describing the error.
13+
example: "Schema validation failed"
14+
data:
15+
type: object
16+
properties:
17+
invalidItems:
18+
type: array
19+
description: A list of invalid items in the received array of items.
20+
items:
21+
type: object
22+
properties:
23+
itemPosition:
24+
type: number
25+
description: The position of the invalid item in the array.
26+
example: 2
27+
validationErrors:
28+
type: array
29+
description: A complete list of AJV validation error objects for the invalid item.
30+
items:
31+
type: object
32+
properties:
33+
instancePath:
34+
type: string
35+
description: The path to the instance being validated.
36+
schemaPath:
37+
type: string
38+
description: The path to the schema that failed the validation.
39+
keyword:
40+
type: string
41+
description: The validation keyword that caused the error.
42+
message:
43+
type: string
44+
description: A message describing the validation error.
45+
params:
46+
type: object
47+
description: Additional parameters specific to the validation error.
48+
required:
49+
- invalidItems
50+
required:
51+
- type
52+
- message
53+
- data

apify-api/openapi/paths/datasets/datasets.yaml

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ post:
106106
Keep in mind that data stored under unnamed dataset follows [data retention period](https://docs.apify.com/platform/storage#data-retention).
107107
It creates a dataset with the given name if the parameter name is used.
108108
If a dataset with the given name already exists then returns its object.
109+
109110
operationId: datasets_post
110111
parameters:
111112
- name: name
@@ -143,25 +144,6 @@ post:
143144
actId: null
144145
actRunId: null
145146
fields: []
146-
'400':
147-
description: ''
148-
headers: {}
149-
content:
150-
application/json:
151-
schema:
152-
allOf:
153-
- $ref: >-
154-
../../components/schemas/datasets/Createdatasetresponseerror.yaml
155-
- example:
156-
error:
157-
type: schema-validation-error
158-
message: >-
159-
Schema validation failed
160-
example:
161-
error:
162-
type: schema-validation-error
163-
message: >-
164-
Schema validation failed
165147
deprecated: false
166148
x-legacy-doc-urls:
167149
- https://docs.apify.com/api/v2#/reference/datasets/dataset-collection/create-dataset

apify-api/openapi/paths/datasets/datasets@{datasetId}@items.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,10 @@ post:
478478
The POST payload is a JSON object or a JSON array of objects to save into the dataset.
479479
480480
481+
If the data you attempt to store in the dataset is invalid (meaning any of the items received by the API fails the validation), the whole request is discarded and the API will return a response with status code 400.
482+
For more information about dataset schema validation, see [Dataset schema](https://docs.apify.com/platform/actors/development/actor-definition/dataset-schema/validation).
483+
484+
481485
**IMPORTANT:** The limit of request payload size for the dataset is 5 MB. If the array exceeds the size, you'll need to split it into a number of smaller arrays.
482486
operationId: dataset_items_post
483487
parameters:
@@ -523,6 +527,35 @@ post:
523527
type: object
524528
example: {}
525529
example: {}
530+
'400':
531+
description: ''
532+
headers: {}
533+
content:
534+
application/json:
535+
schema:
536+
allOf:
537+
- $ref: >-
538+
../../components/schemas/datasets/PutItemResponseError.yaml
539+
- example:
540+
error:
541+
type: schema-validation-error
542+
message: >-
543+
Schema validation failed
544+
example:
545+
error:
546+
type: schema-validation-error
547+
message: >-
548+
Schema validation failed
549+
data:
550+
invalidItems:
551+
- itemPosition: 2
552+
- validationErrors:
553+
instancePath: /1/stringField
554+
schemaPath: /items/properties/stringField/type
555+
keyword: type
556+
params:
557+
type: string
558+
message: 'must be string'
526559
deprecated: false
527560
x-legacy-doc-urls:
528561
- https://docs.apify.com/api/v2#/reference/datasets/item-collection/put-items

0 commit comments

Comments
 (0)