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

Expand properties wrapped inside `oneOf` #30

Closed ewbankkit closed 3 years ago

ewbankkit commented 3 years ago

Relates https://github.com/hashicorp/terraform-provider-awscc/issues/99.

Unwrap a definition like

    "Encryption": {
      "description": "Configures the server-side encryption for Amazon S3 Storage Lens report files with either S3-managed keys (SSE-S3) or KMS-managed keys (SSE-KMS).",
      "type": "object",
      "oneOf": [
        {
          "additionalProperties": false,
          "properties": {
            "SSES3": {
              "description": "S3 default server-side encryption.",
              "type": "object",
              "additionalProperties": false
            }
          },
          "required": [
            "SSES3"
          ]
        },
        {
          "additionalProperties": false,
          "properties": {
            "SSEKMS": {
              "$ref": "#/definitions/SSEKMS"
            }
          },
          "required": [
            "SSEKMS"
          ]
        }
      ]
    },

to

    "Encryption": {
      "description": "Configures the server-side encryption for Amazon S3 Storage Lens report files with either S3-managed keys (SSE-S3) or KMS-managed keys (SSE-KMS).",
      "type": "object",
        "properties": {
          "SSES3": {
            "description": "S3 default server-side encryption.",
            "type": "object",
            "additionalProperties": false
          },
          "SSEKMS": {
            "$ref": "#/definitions/SSEKMS"
          }
        }
      }
    },

with recursive expansion of SSEKMS.