dynamodb-toolbox
dynamodb-toolbox copied to clipboard
is there a way to disable schema checking temporarily?
we don't know our schema well yet; every time we try to save an item with that has a property not defined in the Entity constructor, the operation crashes and the function throws.
we want to be able to disable this error temporarily.
I checked the source code, so I can:
- disable
autoSave&&autoParseon the entity object. - use the Entity functions (put, update) to only generate the objects that dynamodb accepts.
- use aws dynamo client to save the item.
I used this:
async function create (obj: Partial<MyType>) {
entity.autoParse = false;
entity.autoExecute = false;
/**
* I want this function to only generate the params without normalizing them
*/
const params = entity.putParams(obj,);
const created = await DocumentClient.put(params).promise();
console.log({ created });
};
and I still get this error:
"errorMessage": "Field 'me' does not have a mapping or alias",
anybody have a simpler idea?
Hi @jeremydaly is this by design? would be good to know if there's an option to disable this! thank you 🙏
This was by design, but I suppose we could disable it with a flag. Adding to roadmap.
Hey @ahmad-ali14, lately, I've added an option that allows you not to throw an error when an unmapped field is provided, but it does filter it.
It's called strictSchemaCheck.
An example of its usage is listed here.
It will be included in the next release.
I'll be closing this issue for now. Feel free to write a message here if you feel that this issue should be re-opened.
@naorpeled Thank you very much