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

Type field which maps to the type in the registry service #35

Closed tobywf closed 4 years ago

tobywf commented 4 years ago

Issue #, if available: N/A

Description of changes: Add/allow a type field which maps to the type argument for the registry service. Consumers can assume type is RESOURCE if not specified to remain backwards compatible.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

rjlohan commented 4 years ago

Is there anyway we can have enum in there? Not 100% sure if default works for enum but I did not get validation error when I added something like below

        "type": {
            "type": "string",
            "enum": [
                "RESOURCE", 
                “A”, 
                “B”
            ],
            "default": "RESOURCE"
        },

Also, in comment, maybe not mention "Resource" if this will not always have RESOURCE as type.

Per https://json-schema.org/understanding-json-schema/reference/generic.html "It should be noted that const is merely syntactic sugar for an enum with a single element."

If/when we have other types we can change this to enum but right now it's useful just to get this metadata field in for visibility and future proofing.