hashicorp / aws-cloudformation-resource-schema-sdk-go

This package provides AWS CloudFormation Resource Schema functionality in Go
Mozilla Public License 2.0
5 stars 2 forks source link

Work around lack of support for negative-lookahead regexps #5

Closed ewbankkit closed 3 years ago

ewbankkit commented 3 years ago

Validation of property definitions such as

        "Key": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128,
          "pattern": "^(?!aws:)[a-zA-Z+-=._:/]+$"
        },

fail because negative lookahead is not supported by Go's regexp package. Related: https://github.com/xeipuuv/gojsonschema/issues/93.

ewbankkit commented 3 years ago

We can do something similar to the workaround for \Z during schema validation (e.g. replace (?!..) with ()), but this will move the problem to runtime validation of the property.