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

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

Property examples can be an array of arrays #8

Closed ewbankkit closed 3 years ago

ewbankkit commented 3 years ago

Usually a property's examples value is an array of string, e.g.

        "AssociationId": {
            "description": "Unique identifier of the association.",
            "type": "string",
            "pattern": "",
            "examples": [
                "88df7b09-95e8-48c4-a3cb-08c2c20d5110",
                "203dd0ec-0055-4bf0-a872-707f72ef06aa"
            ]
        },

but for AWS:SSM:Association there is a property where examples is an array of array of string:

        "CalendarNames": {
            "type": "array",
            "items": {
                "type": "string"
            },
            "examples": [
                [
                    "calendar1",
                    "calendar2"
                ],
                [
                    "calendar3"
                ]
            ]
        }

This causes a JSON parsing error:

error loading CloudFormation Resource Provider Schema for aws_ssm_association: error parsing ../service/cloudformation/schemas/AWS::SSM::Association.json: error parsing JSON Schema into Resource: json: cannot unmarshal array into Go struct field Property.properties.examples of type string
ewbankkit commented 3 years ago

We should be OK to change

type Property struct {
    ...
    Examples             []string             `json:"examples,omitempty"`
    ...
}

to

type Property struct {
    ...
    Examples             []interface{}             `json:"examples,omitempty"`
    ...
}