FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

lib: improve validation utils and refactor vm argument validation by lundibundi · Pull Request #31480 · nodejs/node · GitHub

/ node Public

lib: improve validation utils and refactor vm argument validation - #31480

Closed
lundibundi wants to merge 2 commits into
nodejs:masterfrom
lundibundi:improve-validation-utils
Closed

lib: improve validation utils and refactor vm argument validation#31480
lundibundi wants to merge 2 commits into
nodejs:masterfrom
lundibundi:improve-validation-utils

Conversation

Copy link
Copy Markdown
Member

The first commit adds basic validation utilities like validateArray, validateBoolean,
validateObject.

The second commit refactors vm.js with the new validators as an example. There are multiple places in the codebase where we manually validate objects and arrays which can be simplified with validators.js.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

//cc @nodejs/vm

Add common validators: `validateArray`, `validateBoolean`,
`validateObject` and appropriate tests.
nodejs-github-bot added the vm Issues and PRs related to the vm subsystem. label Jan 23, 2020
Comment thread lib/vm.js
return contextOptions;
}

function isContext(object) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Member Author

ping @nodejs/vm @BridgeAR (I guess there is no proper group for this one too).

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Member Author

Started another CI to make sure everything is fine, the previous one is quite old.

lundibundi added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Feb 9, 2020
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>

Copy link
Copy Markdown
Member Author

Landed in c405e9b and 2abf0af.

lundibundi closed this Feb 10, 2020
lundibundi deleted the improve-validation-utils branch February 10, 2020 19:46

Copy link
Copy Markdown
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>

Copy link
Copy Markdown
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>
MylesBorins mentioned this pull request Mar 10, 2020
targos added backport-blocked-v12.x and removed author ready PRs that have at least one approval, no outstanding review comments, and a CI started. backport-blocked-v12.x labels Apr 20, 2020
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

Labels

vm Issues and PRs related to the vm subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants


Back | FazBrowse Home | New Git URL