Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oneOf appears to not work correctly (Being treated like allOf) #269

Open
samgurtman-zz opened this issue May 22, 2020 · 0 comments
Open

Comments

@samgurtman-zz
Copy link

samgurtman-zz commented May 22, 2020

Version 1.0.5 of the Java plugin

Schema:

{
    "typeName": "OBFUSCATED::ApiGateway::RestApi",
    "description": "An example resource schema demonstrating some basic constructs and validation rules.",
    "sourceUrl": "https://github.com/aws-cloudformation/aws-cloudformation-rpdk.git",
    "properties": {
        "RestApiId": {
            "type": "string"
        },
        "Name": {
            "description": "Api Name",
            "type": "string"
        },
        "AuthorizerLambdaArn": {
            "type": "string"
        },
        "AuthorizerCredentials": {
            "type": "string"
        },
        "Version": {
            "type": "string"
        },
        "SwaggerS3Location": {
            "description": "Swagger File S3 Location.",
            "type": "object",
            "properties": {
                "Bucket": {
                    "type": "string"
                },
                "Key": {
                    "type": "string"
                },
                "Version" : {
                    "type": "string"
                }
            },
            "required": [
                "Bucket",
                "Key"
            ]

        },
        "EndpointType": {
            "description": "Gateway Endpoint Type",
            "enum" : ["REGIONAL", "EDGE", "PRIVATE"],
            "type": "string"
        },
        "ValidateRequests" : {
            "type": "boolean",
            "description" : "Use Api Gateway request validatoin"
        }
    },
    "oneOf": [
        {
            "properties": {
                "VpcLinkId": {
                    "type": "string"
                },
                "BaseURI": {
                    "type": "string"
                }
            },
            "required":  ["VpcLinkId", "BaseURI"]
        },
        {
            "properties": {
                "LambdaArn" : {
                    "type": "string"
                }
            },
            "required" : ["LambdaArn"]
        }
    ],
    "additionalProperties": false,
    "required": [
        "Name",
        "SwaggerS3Location",
        "EndpointType",
        "AuthorizerLambdaArn",
        "AuthorizerCredentials"
    ],
    "writeOnlyProperties": [
        "/properties/VpcLinkId",
        "/properties/BaseURI",
        "/properties/LambdaArn",
        "/properties/SwaggerS3Location",
        "/properties/ValidateRequests"
    ],
    "readOnlyProperties": [
        "/properties/RestApiId",
        "/properties/Version"
    ],
    "primaryIdentifier": [
        "/properties/RestApiId"
    ],
    "handlers": {
        "create": {
            "permissions": [
                "iam:PassRole",
                "s3:GetObject",
                "s3:GetBucketLocation",
                "apigateway:PATCH",
                "apigateway:POST",
                "apigateway:PUT"
            ]
        },
        "read": {
            "permissions": [
                "apigateway:GET"
            ]
        },
        "update": {
            "permissions": [
                "iam:PassRole",
                "s3:GetObject",
                "s3:GetBucketLocation",
                "apigateway:PATCH",
                "apigateway:POST",
                "apigateway:PUT"
            ]
        },
        "delete": {
            "permissions": [
                "apigateway:DELETE"
            ]
        }
    }
}

Error when using only VpcLinkId and BaseURI in an update operation:

Model validation failed (#: #: only 1 subschema matches out of 2)\n#: 2 schema violations found (#)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant