-
-
Notifications
You must be signed in to change notification settings - Fork 196
Closed
Description
For now, we have an endpoint /api/v1/config that returns something like this:
{
"version": 1,
"tiles": [
{"type": "EMPTYYYY"}
],
"errors": ["Unsupported version", "Columns field is missing", "Unknown tile type EMPTYYYY"]
}That way, we mix config itself and errors added by the Core's Verify method.
For better errors management, we need to:
- split config and errors
- add a unique ID also used as a translation key
- get the raw value which causes the error (configUrl, specific tile's JSON, ...)
With that in mind, we can go to something more like that:
{
"config": {
"version": 1,
"tiles": [
{"type": "EMPTYYYY"}
]
},
"errors": [
{
"id": "ERROR_UNSUPPORTED_VERSION",
"message": "Unsupported version",
"data": {
"configExtract": "{\"version\": 1}",
"expected": ">= 4"
}
},
{
"id": "ERROR_MISSING_REQUIRED_FIELD",
"message": "Columns field is missing",
"data": {
"fieldName": "columns",
"expected": ">= 1"
}
},
{
"id": "ERROR_UNKNOWN_TILE_TYPE",
"message": "Unknown tile type EMPTYYYY",
"data": {
"configExtract": "{\"type\": \"EMPTYYYY\"}",
"expected": "EMPTY, GROUP, PING, PORT, [...]"
}
}
]
}