-
Notifications
You must be signed in to change notification settings - Fork 361
Consider removing #[serde(deny_unknown_fields)]
from request types
#750
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
I don't really remember why I added those attributes, and I don't have a strong opinion about it. Feel free to open a PR. |
ramosbugs
added a commit
to ramosbugs/aws-lambda-rust-runtime
that referenced
this issue
Dec 14, 2023
Adding new fields to request payloads is typically not considered to be a breaking change, but using #[serde(deny_unknown_fields)] would cause all Lambda functions to start failing immediately in production if a new feature were deployed that added a new request field. Fixes awslabs#750.
2 tasks
calavera
pushed a commit
that referenced
this issue
Dec 14, 2023
Adding new fields to request payloads is typically not considered to be a breaking change, but using #[serde(deny_unknown_fields)] would cause all Lambda functions to start failing immediately in production if a new feature were deployed that added a new request field. Fixes #750.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#666 added
#[serde(deny_unknown_fields)]
toApiGatewayProxyRequest
and other request types:aws-lambda-rust-runtime/lambda-events/src/event/apigw/mod.rs
Line 16 in d513b13
Using this serde attribute causes deserialization to fail if any unexpected fields are included in the request payload. This has two negative consequences:
sam local
includes extraneousversion
attribute inApiGatewayLambdaEvent
(incompatible with aws-lambda-rust-runtime) aws/aws-sam-cli#6442, Lambda functions written using this library cannot be tested with versions ofsam local
from the past 3 years. This is a bug inaws-sam-cli
, not theaws_lambda_events
crate, but it illustrates a downside to strict request parsing.Unless there's a strong reason to reject request payloads with unknown fields that outweighs these downsides, I'd recommend removing
deny_unknown_fields
.The text was updated successfully, but these errors were encountered: