Skip to content
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

Feature request: readonly property for attributes #597

Open
napter opened this issue Sep 25, 2023 · 0 comments
Open

Feature request: readonly property for attributes #597

napter opened this issue Sep 25, 2023 · 0 comments

Comments

@napter
Copy link

napter commented Sep 25, 2023

A read only property on an attribute would allow query requests to the entity but update requests with the property set should throw an error. Alternatively, adding an onUpdate event where the entity could review the contents of the update and throw an error if the update shouldn't be allowed to proceed, would allow this (and other checks).

@jeremydaly I just want to thank you for this library and lambda-api. I have started a small middleware that connects the two with a config file. It reads dynamodb entities and registers api paths for them so that in a single config file you can add new simple CRUD apis for dynamodb entities. What do you think of adding something like that to either of the libraries?

It just seems like there are a sequence of steps that need to be reimplemented every time you need a new lambda for dynamodb: create the api path, validate the input properties, call the appropriate dynamodb operation. It requires a lot of boilerplate code. If there was an intermediary that could glue api-gateway/lambda and dynamodb together with simple configurations I think the code would be faster to write and cleaner. I tried searching but couldn't find anything existing that does this.

In this setup, it makes sense to me to use the entity objects to validate that the shape of the data is valid before pushing it. The read only flag or an onUpdate would help with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant