aws-samples / api-gateway-secure-pet-store

Amazon API Gateway sample using Amazon Cognito credentials through AWS Lambda
Apache License 2.0
308 stars 113 forks source link

Generated SDKs contains duplicate models which refers the same object in the API definition #11

Open stevben opened 8 years ago

stevben commented 8 years ago

Hi,

I don't think this is related to api-gateway-secure-pet-store itself, but the problem we face can be reproduced easily with this repository.

It appears that the SDK generation of Api Gateway (iOS, Androïd) is not very smart when dealing with array of objects (Pets in this case). Instead of using the 'Pet' model as the item of the array, the SDK generates a third model called 'Pets_Item' which is exactly the same than 'Pet'.

This is very annoying for Client developers because they have to handle two different classes for the same domain depending of the services they call (GET /pets or GET/pets/{id}).

In result, they have to write patch to have something useable...and the magic suddenly disappears.

Do you think is there any way to avoid the third model by fixing something in the Swagger file ? We tried several changes but without any success.

capture d ecran 2016-03-30 a 23 09 16
sapessi commented 8 years ago

Thanks for the feedback. We are looking into this.

stevben commented 8 years ago

Thanks.

Note that I discuss about that also here with @balakataws. Please tell me where is the best place to speak about that (since the code generation tool is not an opensource project).