Skip to content

Commit 3a2ce98

Browse files
authored
API: Validate empty filter list (#6223)
* Validate empty filter list * Add changelog entry * Add minItems validation to filter clauses in JSON schema Also updates test to reflect that schema validation fires before the Elixir parser, producing a schema-level error message. * Regenerate types after adding minItems to clauses * Remove inner validation
1 parent ad92741 commit 3a2ce98

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ All notable changes to this project will be documented in this file.
2525

2626
### Fixed
2727

28+
- Validate empty filter clauses list in Stats API v2
2829
- Fixed Stats API timeseries returning time buckets falling outside the queried range
2930
- Fixed issue with all non-interactive events being counted as interactive
3031
- Fixed countries map countries staying highlighted on Chrome

assets/js/types/query-api.d.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ export type FilterWithoutGoals =
9090
* filter operation
9191
*/
9292
export type FilterOperationWithoutGoals = "is_not" | "contains_not";
93-
export type Clauses = (string | number)[];
93+
/**
94+
* @minItems 1
95+
*/
96+
export type Clauses = [string | number, ...(string | number)[]];
9497
/**
9598
* @minItems 3
9699
* @maxItems 4

priv/json-schemas/query-api-schema.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@
316316
},
317317
"clauses": {
318318
"type": "array",
319+
"minItems": 1,
319320
"items": {
320321
"type": ["string", "integer"]
321322
}

0 commit comments

Comments
 (0)