Added Schema Check for Data View ID and Index (#3830)
This commit is contained in:
@@ -708,6 +708,12 @@ class QueryRuleData(BaseRuleData):
|
||||
if validator is not None:
|
||||
return validator.get_required_fields(index or [])
|
||||
|
||||
@validates_schema
|
||||
def validates_index_and_data_view_id(self, data, **kwargs):
|
||||
"""Validate that either index or data_view_id is set, but not both."""
|
||||
if data.get('index') and data.get('data_view_id'):
|
||||
raise ValidationError("Only one of index or data_view_id should be set.")
|
||||
|
||||
@validates_schema
|
||||
def validates_query_data(self, data, **kwargs):
|
||||
"""Custom validation for query rule type and subclasses."""
|
||||
|
||||
Reference in New Issue
Block a user