Thanks for your help in advance. Its my bad day.
I have the following json and I am trying to figure out the schema for it. Unfortunately, I was stuck at a point with no sign of error.
Please advise the solution
{
"tables_not_to_mask": ["Table_1"],
"tables_to_mask":{
"Table_2": [
{
"column": "BinLogFilename",
"masking_type": "replace_logfilename"
},
{
"column": "ServerId",
"masking_type": "replace_server_id"
}
],
"Table_3": [
{
"column": "BinLogFilename",
"masking_type": "replace_logfilename"
},
{
"column": "ServerId",
"masking_type": "replace_server_id"
}
]
}
}
The Table_1,Table_2,.. are dynamically added. I have created schema that should validate JSON input in the following,
- tables_not_to_mask and tables_to_mask are required.
- tables_to_mask can have zero or more tables
- If there is table in tables_to_mask, it can have zero to many column and masking_type defined.
- column and masking_type are mandatory and no one is single.
I created the schema for it and unfortunately, if i remove column or masking_type, the schema does not throw any error.
{
"title": "Schema title",
"description": "Description of the schema",
"type": "object",
"properties": {
"tables_not_to_mask": {
"type": "array",
"minItems": 0,
"items": {"type": "string"}
},
"tables_to_mask": {
"type": "object",
"patternProperties": {
".*": {
"type": "array",
"minItems": 0,
"properties": {
"column": {"type": "string"},
"masking_type": {"type": "string"}
},
"required": [
"masking_type",
"column"
]
}
}
}
},
"required": [
"tables_not_to_mask",
"tables_to_mask"
]
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…