Skip to content

fix(instance-validator): don't skip custom validators on null (#9143) - #10310

Merged
sushantdhiman merged 3 commits into
sequelize:masterfrom
papb:master
Jan 5, 2019
Merged

sushantdhiman merged 3 commits into
sequelize:masterfrom
papb:master

Conversation

@papb

@papb papb commented Jan 2, 2019

Copy link
Copy Markdown
Member

Pull Request check-list

Please make sure to review and check all of these items:

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

Fixes #9143. See this comment where the changes created by this PR are explained.

This is technically a breaking change but I believe the amount of affected people will be minimal. Regardless, migration instructions were added to docs/upgrade-to-v5.md and the documentation was properly updated, of course. Also, I since v5 is in beta, I think a minor breaking change is fine at the moment 😁

BREAKING CHANGE: Migration instructions available on upgrade-to-v5.md
Comment thread test/unit/model/validation.test.js Outdated

describe('with allowNull set to true', () => {

const User = current.define('user', {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to before, use as this.User in assertions

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same goes for other tests

@sushantdhiman sushantdhiman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation looks good and good work with docs, just some minor changes to tests and this can be merged

@codecov

codecov Bot commented Jan 4, 2019 •

Copy link
Copy Markdown

Codecov Report

Merging #10310 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10310      +/-   ##
==========================================
+ Coverage   96.28%   96.28%   +<.01%     
==========================================
  Files          68       68              
  Lines        9772     9775       +3     
==========================================
+ Hits         9409     9412       +3     
  Misses        363      363
Impacted Files Coverage Δ
lib/model.js 96.77% <ø> (ø) ⬆️
lib/instance-validator.js 97.6% <100%> (+0.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ecb0868...0f6d723. Read the comment docs.

@papb

papb commented Jan 5, 2019

Copy link
Copy Markdown
Member Author

@sushantdhiman Thanks for the review, I refactored it and also fixed a missing link in the docs.

@sushantdhiman
sushantdhiman merged commit 5296da9 into sequelize:master Jan 5, 2019
@sushantdhiman

Copy link
Copy Markdown
Contributor

Thanks @papb

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

Successfully merging this pull request may close these issues.

Do not skip custom validators if value is null and allowNull is true

2 participants