Skip to content

Commit 26791b1

Browse files
authored
fix(openapi): Fix all OpenAPI linting errors and add stricter validation rules (#2194)
### Issue - Relates #2182 ### Description - Enable `info-license: error` - Add Apache 2.0 license to `openapi.yaml` - Enable `tag-description: error` - Add descriptions to `Storage` and `Webhooks` tags - Enable `no-invalid-schema-examples: error` - Fix all examples in `schema/` dir - Enable `no-invalid-media-type-examples: error` - Fix all examples in `paths/` dir - Enable `operation-4xx-response: error` - Add error response components based on the common `ErrorResponse` - A few more minor fixes - `finishedAt` type is nullable - reference to `CreateOrUpdateVersionRequest` - ... ### Tests - CI passes
1 parent 84814c1 commit 26791b1

89 files changed

Lines changed: 373 additions & 62 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
description: Bad request - invalid input parameters or request body.
2+
content:
3+
application/json:
4+
schema:
5+
$ref: ../schemas/common/ErrorResponse.yaml
6+
example:
7+
error:
8+
type: invalid-input
9+
message: "Invalid input: The request body contains invalid data."
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
description: Not found - the requested resource does not exist.
2+
content:
3+
application/json:
4+
schema:
5+
$ref: ../schemas/common/ErrorResponse.yaml
6+
example:
7+
error:
8+
type: record-not-found
9+
message: The requested resource was not found.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
description: Unauthorized - authentication required or invalid token.
2+
content:
3+
application/json:
4+
schema:
5+
$ref: ../schemas/common/ErrorResponse.yaml
6+
example:
7+
error:
8+
type: token-not-valid
9+
message: Authentication token is not valid.

apify-api/openapi/components/schemas/actor-builds/Build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ example:
9494
buildNumber: 0.1.1
9595
actorDefinition:
9696
actorSpecification: 1
97-
name: exmpla-actor
97+
name: example-actor
9898
version: "1.0"
9999
buildTag: latest
100100
environmentVariables:
@@ -113,7 +113,7 @@ example:
113113
storages:
114114
dataset:
115115
type: object
116-
$schema: "http://json-schema.org/draft-07/schema#"
116+
$schema: http://json-schema.org/draft-07/schema#
117117
properties:
118118
id:
119119
type: string

apify-api/openapi/components/schemas/actor-builds/PostAbortBuildResponse.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ example:
1515
status: ABORTED
1616
meta:
1717
origin: WEB
18+
userAgent: Mozilla/5.0 (iPad)
1819
stats:
1920
durationMillis: 1000
2021
runTimeSecs: 5.718
22+
computeUnits: 0.012699444444444444
2123
options:
2224
useCache: false
2325
memoryMbytes: 1024
@@ -27,3 +29,4 @@ example:
2729
usageTotalUsd: 0.02
2830
usageUsd:
2931
ACTOR_COMPUTE_UNITS: 0.02
32+
buildNumber: 0.1.1

apify-api/openapi/components/schemas/actor-runs/Run.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ properties:
3838
examples: ["2019-11-30T07:34:24.202Z"]
3939
description: Time when the Actor run started.
4040
finishedAt:
41-
type: string
41+
type: [string, "null"]
4242
format: date-time
4343
examples: ["2019-12-12T09:30:12.202Z"]
4444
description: Time when the Actor run finished.

apify-api/openapi/components/schemas/actors/ActorDefinition.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ properties:
1111
description: The name of the Actor.
1212
version:
1313
type: string
14-
pattern: ^[0-9]+\\.[0-9]+$
14+
pattern: ^[0-9]+\.[0-9]+$
1515
description: The version of the Actor, specified in the format [Number].[Number], e.g., 0.1, 1.0.
1616
buildTag:
1717
type: string

apify-api/openapi/components/schemas/actors/ExampleRunInput.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ type: object
66
properties:
77
body:
88
type: string
9-
example:
10-
helloWorld: 123
9+
example: '{ "helloWorld": 123 }'
1110
contentType:
1211
type: string
1312
examples: [application/json; charset=utf-8]

apify-api/openapi/components/schemas/actors/UpdateActorRequest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ properties:
3030
versions:
3131
type: array
3232
items:
33-
$ref: ./CreateOrUpdateEnvVarRequest.yaml
33+
$ref: ./CreateOrUpdateVersionRequest.yaml
3434
description: ""
3535
pricingInfos:
3636
type: array

apify-api/openapi/components/schemas/key-value-stores/KeyValueStore.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ properties:
4646
type: string
4747
format: uri
4848
description: A public link to access keys of the key-value store directly.
49-
examples: ["https://api.apify.com/v2/key-value-stores/WkzbQMuFYuamGv3YF/keys?signature=abc123"]
49+
examples: [https://api.apify.com/v2/key-value-stores/WkzbQMuFYuamGv3YF/keys?signature=abc123]
5050
urlSigningSecretKey:
5151
type: [string, "null"]
5252
description: A secret key for generating signed public URLs. It is only provided to clients with WRITE permission for the key-value store.

0 commit comments

Comments
 (0)