Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

API: Validate empty filter list (#6223)

Uku Taht3a2ce98cc18f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 08621734f9..ff06539c24 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -25,6 +25,7 @@ All notable changes to this project will be documented in this file.
### Fixed
+- Validate empty filter clauses list in Stats API v2
- Fixed Stats API timeseries returning time buckets falling outside the queried range
- Fixed issue with all non-interactive events being counted as interactive
- Fixed countries map countries staying highlighted on Chrome
diff --git a/assets/js/types/query-api.d.ts b/assets/js/types/query-api.d.ts
index 3dce7f6743..a6607a9fca 100644
--- a/assets/js/types/query-api.d.ts
+++ b/assets/js/types/query-api.d.ts
@@ -90,7 +90,10 @@ export type FilterWithoutGoals =
* filter operation
*/
export type FilterOperationWithoutGoals = "is_not" | "contains_not";
-export type Clauses = (string | number)[];
+/**
+ * @minItems 1
+ */
+export type Clauses = [string | number, ...(string | number)[]];
/**
* @minItems 3
* @maxItems 4
diff --git a/priv/json-schemas/query-api-schema.json b/priv/json-schemas/query-api-schema.json
index 99a50badde..1f692ef868 100644
--- a/priv/json-schemas/query-api-schema.json
+++ b/priv/json-schemas/query-api-schema.json
@@ -316,6 +316,7 @@
},
"clauses": {
"type": "array",
+ "minItems": 1,
"items": {
"type": ["string", "integer"]
}