Added Schema Check for Data View ID and Index (#3830)

This commit is contained in:
Eric Forte
2024-07-09 15:05:12 -04:00
committed by GitHub
parent 6a28881b5f
commit ec6038b9d9
+6
View File
@@ -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."""