aws-cloudformation / aws-cloudformation/cloudformation-cli
contract_tests: contract_create_read_success and primaryIdentifiers in responses
- Lingua principale
- Python
- Stelle
- 336
- Fork
- 172
- Merge medio
- 3g 5m
- PR unite (30g)
- 3
Descrizione
When a customer wants to create a our resource, he sends a request like so:
```json
{
"ourObj": {
"someProp": "someValue"
}
}
```
And our API, upon successful creation, will return the following:
```json
{
"ourObj": {
"someProp": "someValue",
"id": "ourJustGeneratedObjId"
}
}
```
It seems that there is no way at all to pass the contract-tests with this schema. Passing a hard-coded value for `ourObj.id` does not make sense, as the delete test will fail.
I've worked around the `contract_create_delete` failure by copying `ourObj.id` to another property in the schema:
```json
{
"CfnId": "ourJustGeneratedObjId",
"ourObj": {
"someProp": "someValue",
"id": "ourJustGeneratedObjId"
}
}
```
`CfnId` is set as the `primaryIdentifier`.
This way, the model sent in the request is returned back in the response - none have the `ourObj.id`. However, our customers may be relying on the existence of this `id` inside `ourObj`.
What can be done about this?
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia leggendo i test contract_create_read_success e contract_create_delete, quindi segui come vengono gestiti primaryIdentifier e primaryIdentifiers nello schema contract-test. Confronta gli esempi di request e response con le aspettative del test di delete e definisci il comportamento previsto per gli identificatori generati prima di modificare qualsiasi cosa.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- aws
- Ambito
- api, cloud, testing
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100