aws-cloudformation / cloudformation-resource-schema

The CloudFormation Resource Schema defines the shape and semantic for resources provisioned by CloudFormation. It is used by provider developers using the CloudFormation RPDK.
Apache License 2.0
93 stars 38 forks source link

Validate examples of properties in schema according to schema #22

Open tobywf opened 5 years ago

tobywf commented 5 years ago

From https://github.com/aws-cloudformation/aws-cloudformation-rpdk/issues/68

At the moment, examples fields aren't validated. The result is invalid examples, e.g. this ARN (rouge dot at the end):

"Arn": {
    "type": "string",
    "pattern": "^arn:aws(-(cn|gov))?:[a-z-]+:(([a-z]+-)+[0-9])?:([0-9]{12})?:[^.]+$"
    "examples": [
        "arn:aws:sqs:us-east-2:123456789012:mystack-myqueue-15PG5C2FC1CW8."
    ]
},

It's a shame JSON schema doesn't do this, but we can add this.

PatMyron commented 4 years ago

It's a shame JSON schema doesn't do this

Agreed. This should probably be upstreamed if we get around to fixing this