aws-cloudformation / aws-cloudformation/cloudformation-cli-typescript-plugin
Resource model break when specifying an array with unique: true
- Ngôn ngữ chính
- TypeScript
- Star
- 46
- Fork
- 18
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
I've noticed when specifying an array with unique: true translates the model into a Set instead of an Array (makes sense)
but then when passing an actual array as example input, the resource provider fails. Consider for example:
```
"Tags": {
"type": "array",
"maxItems": 50,
"uniqueItems": true,
"insertionOrder": false,
"description": "An array of key-value pairs to apply to this resource.",
"items": {
"$ref": "#/definitions/Tag"
}
},
```
with input:
```
"Tags": [{
"Key": "name",
"Value": "value"
}]
```
gives error
`"message": "Error: Error: Unsupported type: object [Tag] for tags (Error)",`
Removing the `uniqueItems` fixes the issue and the main thing I notice is that in the generated code the type changes from a Set to an Array
Hướng dẫn đóng góp
Hướng nghiên cứu
Tái hiện lỗi với schema và dữ liệu đầu vào mẫu đã cho, sau đó kiểm tra model TypeScript được sinh ra và đường dẫn resource-provider để tìm các array được bật uniqueItems. So sánh hành vi khi loại bỏ uniqueItems; được xem là hoàn tất khi array mẫu gồm các đối tượng Tag được chấp nhận trong khi tính duy nhất vẫn được biểu diễn chính xác.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- aws, typescript
- Lĩnh vực
- backend-api-design, cloud
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100