aws-cloudformation / aws-cloudformation/cloudformation-cli-java-plugin

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

未關閉
#269 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Java
星號
30
分支
48
PR 合併指標
30 天內沒有已合併 PR

描述

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 (#)`

貢獻指南

開啟貢獻指南

研究方向

首先,使用包含 VpcLinkId 和 BaseURI 的 schema 與 payload 重現回報的 update validation failure。比較 oneOf 分支中恰好一個、兩個以及一個都沒有時的 validation 結果;當一個有效分支被接受,而無效組合產生預期錯誤時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
java
領域
devtools
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。