jacob-meacham / serverless-plugin-git-variables

:zap: Expose git variables to serverless
MIT License
87 stars 32 forks source link

Add client-side validation of git variables #101

Open f00f opened 1 year ago

f00f commented 1 year ago

I regularly use characters in my commit messages which are invalid for AWS tags. The result is a cloud-side error like this:

1 validation error detected: Value '' failed to satisfy constraint: Member must satisfy regular expression pattern: [\p{L}\p{Z}\p{N}_.:/=+-@]*

The problem is that the time to error is quite long, so I would prefer a client-side error. I can see how this could be problematic as people might use git variables in places other than AWS tags and don't care about this validation - or might need other validations.

Maybe this is not even the right place to add the validation, and a generic validation plugin might be more suitable. E.g.

plugins:
  validation:
    awsTags:
      - ${git:messageSubject}
    awsApiStageName:
      - ${git:repository}
      - ${git:branch}