lib: improve validation utils and refactor vm argument validation#31480
Closed
lundibundi wants to merge 2 commits intonodejs:masterfrom
Closed
lib: improve validation utils and refactor vm argument validation#31480lundibundi wants to merge 2 commits intonodejs:masterfrom
lundibundi wants to merge 2 commits intonodejs:masterfrom
Conversation
Add common validators: `validateArray`, `validateBoolean`, `validateObject` and appropriate tests.
lundibundi
commented
Jan 23, 2020
| return contextOptions; | ||
| } | ||
|
|
||
| function isContext(object) { |
Member
Author
There was a problem hiding this comment.
This is not changed as currently, it skips Arrays to the _isContext function which in turn rejects them. If I use validateObject it would change the error message for Arrays passed to the isContext from expected to be vm.Context to expected to be an Object and since we have explicit tests for this case I decided to not change this for now.
Collaborator
Member
Author
|
ping @nodejs/vm @BridgeAR (I guess there is no proper group for this one too). |
jasnell
approved these changes
Jan 29, 2020
devsnek
approved these changes
Jan 29, 2020
Collaborator
Member
Author
|
Started another CI to make sure everything is fine, the previous one is quite old. |
lundibundi
added a commit
that referenced
this pull request
Feb 10, 2020
Add common validators: `validateArray`, `validateBoolean`, `validateObject` and appropriate tests. PR-URL: #31480 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
lundibundi
added a commit
that referenced
this pull request
Feb 10, 2020
PR-URL: #31480 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
Member
Author
Member
|
@lundibundi does this need to be backported to v13.x? it'll need manual if so. |
MylesBorins
pushed a commit
that referenced
this pull request
Mar 10, 2020
PR-URL: #31480 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
Contributor
|
was able to get this backported... must have been some new changes that landed that made this work. removing label |
MylesBorins
pushed a commit
that referenced
this pull request
Mar 10, 2020
Add common validators: `validateArray`, `validateBoolean`, `validateObject` and appropriate tests. PR-URL: #31480 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The first commit adds basic validation utilities like
validateArray,validateBoolean,validateObject.The second commit refactors
vm.jswith the new validators as an example. There are multiple places in the codebase where we manually validate objects and arrays which can be simplified withvalidators.js.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes//cc @nodejs/vm