aws-cloudformation / aws-cloudformation/cloudformation-cli-typescript-plugin
Resource model break when specifying an array with unique: true
- Lingua principale
- TypeScript
- Stelle
- 46
- Fork
- 18
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Riproduci il malfunzionamento con lo schema mostrato e l’input di esempio, quindi ispeziona il modello TypeScript generato e il percorso di resource-provider per individuare gli array con uniqueItems abilitato. Confronta il comportamento rimuovendo uniqueItems; il lavoro è completato quando l’array di esempio di oggetti Tag viene accettato e l’unicità continua a essere rappresentata correttamente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- aws, typescript
- Ambito
- backend-api-design, cloud
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100