soto-project / soto

Swift SDK for AWS that works on Linux, macOS and iOS
https://soto.codes
Apache License 2.0
877 stars 83 forks source link

Cognito user attributes type #100

Closed NSCoder closed 5 years ago

NSCoder commented 5 years ago

Hi Mantainers!

Thank you for all the effort that you have put into this library, is fantastic to use and very well documented. I was using CognitoIdentityProvider for one of my lambdas and I realized that the User attributes is an array type AttributeListType when it would be easier to use if it where a dictionary.

https://github.com/swift-aws/aws-sdk-swift/blob/23ecff293ad950d1dcae7d7745474835c444cbc7/models/apis/cognito-idp/2016-04-18/api-2.json#L2400-L2403

What do you think? I'm happy to submit a PR if we want to move forward with this change.

jonnymacs commented 5 years ago

@juankaram hello back! And thank you for using this library!

As far as your request - eager / happy to review a PR. I will say that the api definitions come from the api json files which are published by amazon and pulled over from the go sdk. The code is then generated from the json directly, and the aws interfaces expect the structure and datatypes defined in the json.

There is some precedent for making edits, to the json for a service if you want to try it out. If it works, submit a PR, and please update the Readme at models/README.md with details

So I understand, you are proposing to make AttributeListType a map?

NSCoder commented 5 years ago

Yes! The problem is that if you pull all the users for a specific group and then try to read a specific attribute like email, you have to have a nested iteration which is not bad but it could be better if we could just access the value directly.

Sure thing, let me give it a shot and report back.

adam-fowler commented 5 years ago

@juankaram do you have anything else to add to this? For your purposes you could create a dictionary from the array returned in the response.

adam-fowler commented 5 years ago

As there has been no response I am closing this