-
Notifications
You must be signed in to change notification settings - Fork 6
Serde feature does not follow the spec #1
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
Comments
This is a tricky issue because by making this compliant, we'll break compatibility with the main use case of this crate, which is to be used with the aws_lambda_events crate. AWS API Gateway does this very weird thing with headers and parameters, and not following the spec here is better for the final user of aws_lambda_events: |
I have to unfortunately agree. It seems like a downgrade from Version 1.0. I think this makes it impossible to have commas inside a query string. I stumbled into this bug (feature?) while writing a crate to integrate the One workaround I can think of is to manually re-join the vector with commas inside my crate but I have to check If this doesn't have unintended consequences. |
what if we had two features, the I'm not sure if this would solve your problem though. |
My problem can only be solved by AWS launching a version 3.0 in which multivalued headers are serialized as an array of strings instead of creating an ad-hoc format. However, I think it's a good idea still. It makes it so that other people outside the AWS ecosystem can use this crate. One question. If the payload is version 1.0, does the |
yes, you can do that. Version 1.0 doesn't split them by comma. Which could also open an option to fix this problem. If we have two deserializers, one for v2, and another one spec compliant under the same feature, we can add attributes to the aws_lambda_events fields to use different deserializers. |
That would be nice. I would help with a PR but I'm new to that codebase and I think it uses some codegen stuff that I don't understand. 😅 Thanks for your help! |
oh, it's actually not that hard anymore. This is what we need to do if you want to update your PR:
|
Deserializing a string with comma separating values should not result in a vector of strings. The whatwg spec does not assign any special meaning to the comma.
This can be confirmed inside a javascript console
If foo is a multivalued query, the
serde_json::Value
should already contain a vector of strings.The text was updated successfully, but these errors were encountered: