- Rename fixtures/items.json to fixtures/array.json to better reflect array testing constraints. - Update reference paths in src/tests/fixtures.rs and across other fixture JSON files. - Remove unused HashMap import in src/validator/rules/dict.rs to resolve the compiler warning.
130 lines
2.7 KiB
JSON
130 lines
2.7 KiB
JSON
[
|
|
{
|
|
"description": "pattern validation",
|
|
"database": {
|
|
"types": [
|
|
{
|
|
"name": "pattern_0_0",
|
|
"schemas": {
|
|
"pattern_0_0": {
|
|
"pattern": "^a*$"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "a matching pattern is valid",
|
|
"data": "aaa",
|
|
"schema_id": "pattern_0_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "a non-matching pattern is invalid",
|
|
"data": "abc",
|
|
"schema_id": "pattern_0_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false,
|
|
"errors": [
|
|
{
|
|
"code": "PATTERN_VIOLATED",
|
|
"values": {
|
|
"pattern": "^a*$",
|
|
"value": "abc"
|
|
},
|
|
"details": {
|
|
"path": "",
|
|
"schema": "pattern_0_0"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"description": "ignores booleans",
|
|
"data": true,
|
|
"schema_id": "pattern_0_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "ignores integers",
|
|
"data": 123,
|
|
"schema_id": "pattern_0_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "ignores floats",
|
|
"data": 1,
|
|
"schema_id": "pattern_0_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "ignores objects",
|
|
"data": {},
|
|
"schema_id": "pattern_0_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "ignores arrays",
|
|
"data": [],
|
|
"schema_id": "pattern_0_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "ignores null",
|
|
"data": null,
|
|
"schema_id": "pattern_0_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "pattern is not anchored",
|
|
"database": {
|
|
"types": [
|
|
{
|
|
"name": "pattern_1_0",
|
|
"schemas": {
|
|
"pattern_1_0": {
|
|
"pattern": "a+"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "matches a substring",
|
|
"data": "xxaayy",
|
|
"schema_id": "pattern_1_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
}
|
|
]
|
|
}
|
|
] |