Skip to content

Commit 3dcf8a2

Browse files
authored
Make json schema validations stricter (librenms#17804)
1 parent 9bab49e commit 3dcf8a2

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/definitions/config_definitions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@
10291029
"default": {}
10301030
},
10311031
"type": "array",
1032-
"validaton": {
1032+
"validate": {
10331033
"value": "array",
10341034
"value.*": "array"
10351035
}

resources/definitions/schema/config_schema.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434
},
3535
"validate": {
3636
"propertyNames": {
37-
"pattern": "^value",
38-
"type": "string"
37+
"pattern": "^value"
3938
},
4039
"required": ["value"]
4140
},
@@ -134,8 +133,7 @@
134133
"directory"
135134
]
136135
}
137-
},
138-
"not": { "required": ["options"]}
136+
}
139137
}
140138
],
141139
"dependencies": {

tests/YamlSchemaTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private function validateFileAgainstSchema(string $filePath, string $schema_file
115115
$validator->validate(
116116
$data,
117117
$schema,
118-
Constraint::CHECK_MODE_TYPE_CAST // | Constraint::CHECK_MODE_VALIDATE_SCHEMA
118+
Constraint::CHECK_MODE_TYPE_CAST | Constraint::CHECK_MODE_VALIDATE_SCHEMA | Constraint::CHECK_MODE_EXCEPTIONS
119119
);
120120
} catch (JsonDecodingException $e) {
121121
// Output the filename so we know what file failed

0 commit comments

Comments
 (0)