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

BOOL schema type and upgrade vogels #46

Open
trung-huynh opened this issue Sep 24, 2017 · 2 comments
Open

BOOL schema type and upgrade vogels #46

trung-huynh opened this issue Sep 24, 2017 · 2 comments

Comments

@trung-huynh
Copy link

trung-huynh commented Sep 24, 2017

Hi there,

There is an error in current vogels version (~0.12.0) with BOOL schema type which is using 'N' dynamoDB attribute value instead of 'BOOL' attribute value, I guess probably because at the point of developing that vogels version, dynamoDB wasn't support BOOL type yet, the code I investigated in vogels 0.12.0:

Schema.prototype.Boolean = function (attrName, options) {
  var attributeType = 'N';
  return internals.baseSetup(this, attrName, Joi.boolean(), attributeType, options);
};

The latest vogels version (2.2.0) as well as dynamoDB has supported BOOL and it leads to data inconsistency if sails-dynamodb still uses the old version of vogel, here is the code snippet from latest vogels:

internals.wireType = function (key) {
  switch (key) {
    case 'string':
      return 'S';
    case 'date':
      return 'DATE';
    case 'number':
      return 'N';
    case 'boolean':
      return 'BOOL';
    case 'binary':
      return 'B';
    case 'array':
      return 'L';
    default:
      return null;
  }
};

Do you have any plan to update to the latest version?

Many thanks,
Trung.

@ferrants
Copy link
Collaborator

I have no plans to update this, but I'm happy to look at a PR.

@elipeters
Copy link

throw new Error("Wrong filter given :" + filter); filter is out of scope and throws undefined

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

3 participants