baseprime / dynamodb

DynamoDB data mapper for Node.js
Other
296 stars 88 forks source link

Design issue with using Joi #67

Open marklabenski opened 5 years ago

marklabenski commented 5 years ago

I wonder why nobody pointed this out yet:

I think it was a bad descision to make Joi required for using dynamodb on one hand, but on the other hand it's not included in the dependencies. (something like "dynamo.joi" or "dynamo.joiTypes" maybe?) Sure, everyone who knows JS will be able to require Joi and using it with dynamodb, but it's not mentioned anywhere and there is no "fallback" provided if you don't want to use joi at all.

Could you come up with a resolution or will you change this in the future?

Best, Mark

petracles commented 4 years ago

Having problems myself with Joi right now. I know it's super-popular and reliable, but just seems unnecessary to document schema definitions in this way.

MickL commented 4 years ago

Could you please explain why Joi is a bad decision and what would be an alternative?

There is an open PR btw that updated all the dependencies, including Joi.

petracles commented 4 years ago

Hey @MickL - novice move on my part. When writing my previous comment, I was new to Joi and it's validation superpowers. I believe my frustrations before were learning more about Joi than with anything in regards to dynamodb. Sry for the vague comment above!

That said, I actually ended up using my own wrapper on DynamoDB.DocumentClient because of

  1. Some product requirements I had to follow and
  2. Being forced to npm i with the --no-optional flag b/c of this issue here.
MickL commented 4 years ago

@petracles I am really curious what requirements you had that couldnt be done with this module. And what did you do in your wrapper to match those requirements?

For the other issue: The dependencies of this module are very outdated and dont work with latest node version. There is an open PR that fixes that, but seems like this module is no more maintained. You can use my fork for now, I will comment here: https://github.com/baseprime/dynamodb/issues/50

daveteu commented 4 years ago

why doesn't README have anything that talks about Joi.

First time using dynamodb, came to this repo because of google search.

First part of README already asking to use Joi but not mentioned. Joi is popular and every JS should know about Joi is pretty subjective, I did JS for a long while now and I've never used Joi.