Skip to content

Commit ef1ec73

Browse files
committed
fix(specs): event.status can be null
1 parent f302a85 commit ef1ec73

File tree

6 files changed

+66
-7
lines changed

6 files changed

+66
-7
lines changed

scripts/cts/testServer/algoliaMock.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ function addRoutes(app: Express): void {
3737
processingTimeMS: 0,
3838
});
3939
});
40+
41+
app.get('/1/runs/:runID/events/:eventID', (req, res) => {
42+
res.json({
43+
eventID: req.params.eventID,
44+
runID: req.params.runID,
45+
status: null,
46+
type: 'log',
47+
batchSize: 100,
48+
data: null,
49+
publishedAt: '2023-10-03T12:00:00Z',
50+
});
51+
});
4052
}
4153

4254
export function algoliaMockServer(): Promise<Server> {

scripts/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ apic() {
1919
export apic
2020

2121
_list_languages() {
22-
cat $ROOT/config/clients.config.json | jq -r 'keys[]'
22+
cat $ROOT/config/clients.config.json | jq -r 'keys[] | select(. != "$schema")'
2323
}
2424

2525
_list_languages_all() {

specs/ingestion/common/schemas/event.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ Event:
1818
minimum: 0
1919
multipleOf: 1
2020
data:
21-
type: object
22-
additionalProperties: true
21+
oneOf:
22+
- type: object
23+
additionalProperties: true
24+
- type: 'null'
2325
publishedAt:
2426
$ref: './common.yml#/publishedAt'
2527
required:
@@ -31,8 +33,10 @@ Event:
3133
- publishedAt
3234

3335
EventStatus:
34-
type: string
35-
enum: [created, started, retried, failed, succeeded, critical]
36+
oneOf:
37+
- type: string
38+
enum: [created, started, retried, failed, succeeded, critical]
39+
- type: 'null'
3640

3741
EventType:
3842
type: string

templates/python/model_generic.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
1212
{{> model_description}}
1313

1414
{{#vars}}
15-
{{name}}: {{^required}}Optional[{{/required}}{{{dataType}}}{{^required}}]{{/required}}{{^required}} = None{{/required}}
15+
{{name}}: {{^required}}Optional[{{/required}}{{{dataType}}}{{#required}}{{#isNullable}} | None{{/isNullable}}{{/required}}{{^required}}]{{/required}}{{^required}} = None{{/required}}
1616
{{#description}}
1717
""" {{{.}}} """
1818
{{/description}}

tests/CTS/client/ingestion/api.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@
102102
},
103103
"expected": {
104104
"type": "response",
105-
"match": {"message":"OK"}
105+
"match": {
106+
"message": "OK"
107+
}
106108
}
107109
}
108110
]
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[
2+
{
3+
"testName": "can deserialize an event",
4+
"autoCreateClient": false,
5+
"steps": [
6+
{
7+
"type": "createClient",
8+
"parameters": {
9+
"appId": "test-app-id",
10+
"apiKey": "test-api-key",
11+
"region": "us",
12+
"customHosts": [
13+
{
14+
"port": 6686
15+
}
16+
]
17+
}
18+
},
19+
{
20+
"type": "method",
21+
"method": "getEvent",
22+
"parameters": {
23+
"runID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
24+
"eventID": "6c02aeb1-775e-418e-870b-1faccd4b2c0a"
25+
},
26+
"expected": {
27+
"type": "response",
28+
"match": {
29+
"eventID": "6c02aeb1-775e-418e-870b-1faccd4b2c0a",
30+
"runID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
31+
"status": null,
32+
"type": "log",
33+
"batchSize": 100,
34+
"data": null,
35+
"publishedAt": "2023-10-03T12:00:00Z"
36+
}
37+
}
38+
}
39+
]
40+
}
41+
]

0 commit comments

Comments
 (0)