我想使用 json 模式来验证这样的事情:
{
"function_mapper": {
"critical": [
"DataContentValidation.get_multiple_types_columns",
"DataContentValidation.get_invalid_session_ids"
],
"warning": [
"DataContentValidation.get_columns_if_most_data_null",
"FeatureContentValidation.detect_inconsistencies"
]
}
}
Class.function
我想使用正则表达式来检查列表内容是否看起来像'dataContentValidation.get_multiple_types_columns'
这样
{
"type": "object",
"properties": {
"function_mapper": {
"type": "object",
"properties": {
"critical": {
"type": "array",
"uniqueItems": True,
"items":
{
"type": "string",
"pattern": r"[A-Z]\w+\.\w+"
# TODO add pattern that represent a class and function i.e: Class.function
}
},
"error": {
"type": "array",
"items": [
{
"type": "string",
"pattern": r"[A-Z]\w+\.\w+"
# TODO add pattern that represent a class and function i.e: Class.function
}
]
},
"informative": {
"type": "array",
"items": [
{
"type": "string",
"pattern": r"[A-Z]\w+\.\w+"
# TODO add pattern that represent a class and function i.e: Class.function
}
]
}
}
},
"days_gap": {"type": "integer", "minimum": 0},
"timestamp_column": {"type": "string"},
"missing_data_median_epsilon": {"type": "number", "minimum": 0, "maximum": 1},
"group_by_time_unit": {"type": "string", "enum": ["d", "w", "m", "h", "T", "min", "s"]},
"null_data_percentage": {"type": "number", "minimum": 0, "maximum": 1},
"common_feature_threshold": {"type": "number", "minimum": 0, "maximum": 1},
"columns_to_count": {"type": "array", "items": {"type": "string"}},
"cluster_median_epsilon": {"type": "number", "minimum": 0, "maximum": 1},
"app_session_id_column": {"type": "string"}
}
}
我也尝试用项目替换包含但它仍然不起作用。我究竟做错了什么?