Skip to content

Commit 6816e1e

Browse files
authored
Fix validation of declaration files with filters (#1191)
2 parents 0a96b33 + 613a8f9 commit 6816e1e

22 files changed

+319
-1
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
All changes that impact users of this module are documented in this file, in the [Common Changelog](https://common-changelog.org) format with some additional specifications defined in the CONTRIBUTING file. This codebase adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
44

5+
## Unreleased [patch]
6+
7+
> Development of this release was supported by the [French Ministry for Foreign Affairs](https://www.diplomatie.gouv.fr/fr/politique-etrangere-de-la-france/diplomatie-numerique/) through its ministerial [State Startups incubator](https://beta.gouv.fr/startups/open-terms-archive.html) under the aegis of the Ambassador for Digital Affairs.
8+
9+
### Fixed
10+
11+
- Fix validation of declaration files with filters
12+
513
## 7.2.1 - 2025-09-11
614

715
_Full changeset and discussions: [#1189](https://github.com/OpenTermsArchive/engine/pull/1189)._

scripts/declarations/validate/definitions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const definitions = {
3838
{
3939
type: 'object',
4040
description: 'Filter function with parameters. The key is the filter function name, the value is the parameters.',
41-
additionalProperties: false,
41+
additionalProperties: true,
4242
minProperties: 1,
4343
maxProperties: 1,
4444
},
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Privacy Policy": [
3+
{
4+
"fetch": "https://example.com/privacy",
5+
"select": "div.content",
6+
"validUntil": "2023-12-31"
7+
}
8+
]
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"Privacy Policy": [
3+
{
4+
"fetch": "https://example.com/privacy",
5+
"select": "div.content"
6+
}
7+
]
8+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "Service with additional properties",
3+
"terms": {
4+
"Privacy Policy": {
5+
"fetch": "https://example.com/privacy",
6+
"select": "div.content"
7+
}
8+
},
9+
"unexpectedProperty": "value"
10+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "Service with invalid filter object",
3+
"terms": {
4+
"Privacy Policy": {
5+
"fetch": "https://example.com/privacy",
6+
"select": "div.content",
7+
"filter": [
8+
{
9+
"filterName": {
10+
"param": "value"
11+
},
12+
"unexpectedAdditionalProperty": "value"
13+
}
14+
]
15+
}
16+
}
17+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "Service with invalid terms type",
3+
"terms": {
4+
"Invalid Terms Type": {
5+
"fetch": "https://example.com/privacy",
6+
"select": "div.content"
7+
}
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "Service with invalid URL",
3+
"terms": {
4+
"Privacy Policy": {
5+
"fetch": "not-a-valid-url",
6+
"select": "div.content"
7+
}
8+
}
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "Service without fetch",
3+
"terms": {
4+
"Privacy Policy": {
5+
"select": "div.content"
6+
}
7+
}
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"terms": {
3+
"Privacy Policy": {
4+
"fetch": "https://example.com/privacy",
5+
"select": "div.content"
6+
}
7+
}
8+
}

0 commit comments

Comments
 (0)