awslabs / aws-lambda-rust-runtime

A Rust runtime for AWS Lambda
Apache License 2.0
3.3k stars 335 forks source link

Lambda events and the optionality of attributes - issues to clarify #858

Closed baldram closed 3 months ago

baldram commented 5 months ago

Hi there!

Thanks for the massive amount of work put into developing this project. I've got an idea for an improvement I'd like to share.

Looking at the implementation of models for lambda events, some doubts have emerged in several places, which may require clarification and possibly correction.

Can I ask about the source on which the models for lambda events are implemented? I've scoured the entire internet, looking not only for written documentation but also Smithy, etc. At most, I found EventBridge Schemas, but not for lambda events. I sporadically managed to find something in AWS Documentation, but only for a few events.

And where I did find a contract definition, I discovered inconsistencies in the implementation in this repository.

Let's take a closer look at the following:

I could probably send a Pull Request, but it will involve breaking changes. I'm not sure if this is something that has to wait for a Major Release. On the other hand, these seem to be important issues.

And this raises the question of how we can verify the remaining events? That's why I was asking about the specification on which these things were implemented.

calavera commented 5 months ago

I could probably send a Pull Request, but it will involve breaking changes. I'm not sure if this is something that has to wait for a Major Release. On the other hand, these seem to be important issues.

We make these kind of changes all the time. We're not guaranteeing backwards compatibility between minor versions at the moment. See my latest PR where I changed an optional string to an enum: https://github.com/awslabs/aws-lambda-rust-runtime/pull/856/files#diff-68127a0a666444f6d22fb233e1b76b2be5f9379e390679c4e9cdcba5d1ce0a9cR24

And this raises the question of how we can verify the remaining events? That's why I was asking about the specification on which these things were implemented.

Unfortunately, there is no easy way to verify events except by triggering them and inspecting the payloads. All these events were generated based on the Go events. Go doesn't have great string semantics, so everything that was a string in Go was translated as Option<String> in Rust.

We've improved many events with the help of contributors like yourself, so don't hesitate to send PRs that can benefit other people..

github-actions[bot] commented 3 months ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one.

baldram commented 3 months ago

Thanks @calavera. I was hoping this would be a good motivation to install the tooling, IDE, and take my first steps with Rust. But somehow, current tasks kept me busy. I'll need to report other things ;) some excuse for an MR, and finally get around to Rust.