Comments (9)
I agree that we should validate this data. The reason data is currently only validated during create is because during update you can pass different pieces of data which are completely valid during update, but would not be valid when creating an initial record. Such as partial updates, removing params from dynamodb, and adding items to Sets.
I'm sure there is a good solution for this, but I want to be careful that we don't over complicate things and potentially make it difficult to fully utilize the feature DynamoDB offers
from vogels.
@ryanfitz I've got on similar issue this week and some coworkers have faced it too in the past. I've two different suggestions that could be implemented (I could open the PR if you prefer and don't have time to it). First one would be add an option like 'updateValidation' (false as default) and it would be able validation before update. The problem that I see on this feature is that it is a little bit intrusive.
The second one would be able to return the object schema and them it would be able to validate it before performing an update whenever the developer feels it is necessary.
Would like to know your opinion. I'm adapting (not modifying the lib) the second solution over here as we've faced some problems...
from vogels.
@viniciuskneves Yes, this issue need to be handled, an record update is important operation as much as create, so we must validate data before update.
We should have separate mechanism to validate data on update eg. updateValidations() or validateOnUpdate(true) during schema.
from vogels.
validation mechanism in vogels is incomplete without this
+1 for this feature
from vogels.
+1 for feature
from vogels.
+1 for feature
from vogels.
+1
I would also like to do on demand validation, before making the create request, which currently seems impossible due to table/schema being private.
from vogels.
@sjungwirth I finally found you can access the table/schema by calling model.scan(), which returns an object with the table, which contains the schema object, which you can call validate. It's hacky but it seems the easiest way to access the object.
from vogels.
@AaronHarris this is really helpful, thank you. While looking into what you said it looks like there is a reference to table
on model instances as well. So it looks like either of these will work:
myModelInstance.table.schema.validate(myModelInstance)
or MyModel.scan().table.schema.validate(myDataOrModelInstanceToValidate)
from vogels.
Related Issues (20)
- Setting StreamSpecification option during table create/update? HOT 1
- ConfigError: Missing region in config
- Secondary Index - ValidationException: The provided starting key is invalid HOT 2
- Vogels is getting stuck when Dynamodb call timeouts HOT 2
- Is $add atomic? (no doc reference) HOT 2
- How can i get all the records using scan ... now i am getting only 780 items .. I need to scan all 50000 items HOT 4
- Dynamodb Error: Nodejs App with dynamodb does not work in docker but works without it HOT 6
- Using eachSeries causes slow table creation
- Problem writing tests using mocha with vogels HOT 12
- Multiple Batch Get Items with different Tables.Handling table references
- scan().limit() return 0 Count and items HOT 1
- How to handle array of objects in models HOT 1
- conditional get an item using get() HOT 1
- Empty object in Dynamo DB when using conditional validation
- Retry logic will indefinitely retry
- strongly consistent reads in scan operation
- Support for Amazon Trust Services (ATS)
- Enable encryption (SSESpecification) when creating table
- Abandoned project?
- Adding extra 's' after the table name HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vogels.