Skip to content

Remove #[serde(deny_unknown_fields)] #753

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

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lambda-events/src/event/alb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use serde::{Deserialize, Serialize};
/// `AlbTargetGroupRequest` contains data originating from the ALB Lambda target group integration
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
pub struct AlbTargetGroupRequest {
#[serde(with = "http_method")]
pub http_method: Method,
Expand Down
3 changes: 0 additions & 3 deletions lambda-events/src/event/apigw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use std::collections::HashMap;
/// `ApiGatewayProxyRequest` contains data coming from the API Gateway proxy
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
pub struct ApiGatewayProxyRequest<T1 = Value>
where
T1: DeserializeOwned,
Expand Down Expand Up @@ -120,7 +119,6 @@ where
/// `ApiGatewayV2httpRequest` contains data coming from the new HTTP API Gateway
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
pub struct ApiGatewayV2httpRequest {
#[serde(default, rename = "type")]
pub kind: Option<String>,
Expand Down Expand Up @@ -335,7 +333,6 @@ pub struct ApiGatewayRequestIdentity {
/// `ApiGatewayWebsocketProxyRequest` contains data coming from the API Gateway proxy
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
pub struct ApiGatewayWebsocketProxyRequest<T1 = Value, T2 = Value>
where
T1: DeserializeOwned,
Expand Down
4 changes: 0 additions & 4 deletions lambda-events/src/event/cloudformation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ where

#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[serde(rename_all = "PascalCase")]
#[serde(deny_unknown_fields)]
pub struct CreateRequest<P2 = Value>
where
P2: DeserializeOwned + Serialize,
Expand All @@ -37,7 +36,6 @@ where

#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[serde(rename_all = "PascalCase")]
#[serde(deny_unknown_fields)]
pub struct UpdateRequest<P1 = Value, P2 = Value>
where
P1: DeserializeOwned + Serialize,
Expand All @@ -60,7 +58,6 @@ where

#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[serde(rename_all = "PascalCase")]
#[serde(deny_unknown_fields)]
pub struct DeleteRequest<P2 = Value>
where
P2: DeserializeOwned + Serialize,
Expand All @@ -87,7 +84,6 @@ mod test {

#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[serde(rename_all = "PascalCase")]
#[serde(deny_unknown_fields)]
struct TestProperties {
key_1: String,
key_2: Vec<String>,
Expand Down
2 changes: 1 addition & 1 deletion lambda-http/src/deserializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ mod tests {

#[test]
fn test_deserialize_error() {
let err = serde_json::from_str::<LambdaRequest>("{\"command\": \"hi\"}").unwrap_err();
let err = serde_json::from_str::<LambdaRequest>("{\"body\": {}}").unwrap_err();

assert_eq!(ERROR_CONTEXT, err.to_string());
}
Expand Down