-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect complaint wrt provided types #2826
Comments
Hi @sawilde, Sorry for the noise. The documentation you're referencing is unfortunately incorrect. I'll contact the SQS team to have that updated. That particular shape is modeled as a list of strings. In the process of migrating SQS from query to json protocol, we found that things like this (i.e. ints being passed when they should be strings) worked because they're built into a query string and parsed out by the service. In order to avoid breaking customers, we added middleware that emits a warning if an incorrect type is found and then casts it to its correct type. I'd recommend updating the value to a string whenever you have a chance. |
@stobrien89 thanks for the update - I am surprised the doc error has gone unnoticed for so long |
However should we be exposing API internals to users like this in the SDK, since the field is an integer (I can't give it |
I think it's just due to the fact that it didn't matter before since it all ended up in a string. Now that input values must be their modeled type (after the migration to json), I think we might see a bit more of this. The SQS team is aware of this and should have their docs fixed soon. Could you elaborate on your last comment? |
I think having to convert something that is an integer (real world usage eg message size) into a string to meet a API transport layer need is something I would expect an SDK to do and is not something a developer should have to think about. We model it as a integer in our heads and that is how we expose it through our own code on our way to calling the SDK. Now if it is a string there is potential for developers to leak that implementation specific of This is just my opinion of what I expect of an SDK to do for me. |
I see what you're saying now and I understand how that can be frustrating as a developer. I think historically we as an organization were of that mind years ago (see the JS SDK V2), but that has changed over time as we've added new (approaching 400) services while simultaneously striving for behavior parity across all of the AWS language SDKs. Delegating the responsibility of handling input validation to AWS services is more of the direction we're heading now— this is a much more scaleable approach for us. Closing this for now, but please let us know if you have any additional questions. |
|
@stobrien89 @sawilde I understand both points of view here. Thanks for the comments. But I'm a little confused and seeing these warnings too. The part I'm confused about is we are getting conflicting warnings for the same element name. It just depends if its in E.G. Consider
I can see what the fix is here, but beyond the discussion regarding type handling, isn't this terribly inconsistent? Or am I missing something? |
Describe the bug
Migrating aws/aws-sdk-php from
3.285.0
to3.286.1
we received the following errorwhen trying the create a queue in localstack (we are using the latest v3 of localstack that now supports JSON 1.0 for SQS) using the following code
fixing this is trivial (convert to string) but I am not convinced this is the correct approach as the model we were using is correct for the spec for CreateQueue (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_CreateQueue.html) indicates that
ReceiveMessageWaitTimeSeconds
is an integerI also get the same issue with
MaximumMessageSize
attribute (also defined as an integer).Expected Behavior
Integer attributes for fields such as
ReceiveMessageWaitTimeSeconds
andMaximumMessageSize
should be accepted as integers as there were in3.285.0
Current Behavior
Integer values are currently being rejected and now need to be converted to strings
Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
SDK version used
3.286.1
Environment details (Version of PHP (
php -v
)? OS name and version, etc.)PHP 8.2.9 (cli) (built: Aug 17 2023 22:52:44) (NTS)
The text was updated successfully, but these errors were encountered: