Skip to content

Commit

Permalink
feat: add new check for topic name compliance in gitops validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Yann Rouillard committed Feb 5, 2024
1 parent 2399046 commit 5de7ad9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions kp_pre_commit_hooks/gitops-values-validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,12 @@ def validate_additional_checks(self, validator, additional_checks, value, schema
if check_method := getattr(self, f"validate_{camel_to_snake(check)}", None):
yield from check_method(value, schema)

def validate_topic_name_compliance(self, value, schema):
match = TOPIC_NAME_REGEXP.match(str(value))
service_name = self.service_instance_config.service_name
if match and match["serviceName"] != service_name:
yield ValidationError(f"topicName '{value}' it not compliant, it should contain the service name '{service_name}'")


def format_error(error: Union[ValidationError, SchemaValidationError]):
if isinstance(error, SchemaValidationError):
Expand Down

0 comments on commit 5de7ad9

Please sign in to comment.