aws-lambda-events
aws-lambda-events copied to clipboard
Add Default derive for structs that can support it
Many structs can be used part of the regular function code. It's very cumbersome to create them by hand if you only need to add a few fields, and want to leave the rest as defaults. We should include Default as part of the derivations, or implement it when possible, so it's easier to work with events manually.
A couple of examples that could be simplified:
Ok(ApiGatewayV2httpResponse {
status_code: 200,
headers: HeaderMap::new(),
multi_value_headers: HeaderMap::new(),
body: Some(Body::Text(response)),
is_base64_encoded: Some(false),
cookies: vec![],
})
https://github.com/cargo-lambda/cargo-lambda/blob/main/crates/cargo-lambda-watch/src/trigger_router.rs#L98-L132
I'm up for doing some of these.
This would remove a massive amount of boilerplate. 👍🏻