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

configuration validation : strict "Promise" instanceof validation #258

Closed
jbottigliero opened this issue Jan 31, 2018 · 5 comments
Closed

Comments

@jbottigliero
Copy link
Member

Do you want to request a feature or report a bug?
Feature.

What is the current behavior?
#240 introduces validation which causes Promise based configurations to pass due to instanceof Function being true.

What is the expected behavior?
At the point the validation runs, the configuration can never be just a Function, it's expected to be an object, an array of objects, or a Promise.

If this is a feature request, what is motivation or use case for changing the behavior?
Provide stricter validation schema.

Please mention other relevant information such as the browser version, Node.js version, Operating System and programming language.

The main concern with adding the above is that it requires webpack/webpack#6430.

The ajv-keywords package does not support "instanceof": "Promise" in versions <3.1.0, which has a peerDependency of ajv@^6.0.0.

An alternative to updating the package versions would be to add Promise as a "custom" constructor (outlined here), but this would still have to be implemented in webpack/webpack based ajv being configured in core, and not directly exposed.

jbottigliero pushed a commit to jbottigliero/webpack-cli that referenced this issue Feb 2, 2018
- updates configuration schema to use `"instanceof": "Promise"` (webpack#258)

depends on (webpack/webpack#6430)
@jbottigliero
Copy link
Member Author

I have a branch ready with this change that I will PR once webpack/webpack#6430 is part of a tagged release.

@evenstensberg
Copy link
Member

Sounds good

jbottigliero pushed a commit to jbottigliero/webpack-cli that referenced this issue Feb 17, 2018
- updates configuration schema to use `"instanceof": "Promise"` (webpack#258)

depends on (webpack/webpack#6430)
@dhruvdutt
Copy link
Member

webpack 4.0.0 is out. 🔥

@jbottigliero Can we make the PR now?

jbottigliero pushed a commit to jbottigliero/webpack-cli that referenced this issue Mar 1, 2018
- updates configuration schema to use `"instanceof": "Promise"` (webpack#258)

depends on (webpack/webpack#6430)
jbottigliero pushed a commit to jbottigliero/webpack-cli that referenced this issue Mar 1, 2018
- updates configuration schema to use `"instanceof": "Promise"` (webpack#258)

depends on (webpack/webpack#6430)
@jbottigliero
Copy link
Member Author

@dhruvdutt – opened #298, cheers!

jbottigliero pushed a commit to jbottigliero/webpack-cli that referenced this issue Mar 1, 2018
- updates configuration schema to use `"instanceof": "Promise"` (webpack#258)
- depends on (webpack/webpack#6430)
jbottigliero pushed a commit to jbottigliero/webpack-cli that referenced this issue Mar 1, 2018
- updates configuration schema to use `"instanceof": "Promise"` (webpack#258)
- depends on (webpack/webpack#6430)
evenstensberg pushed a commit that referenced this issue Mar 1, 2018
- updates configuration schema to use `"instanceof": "Promise"` (#258)
- depends on (webpack/webpack#6430)
@jbottigliero
Copy link
Member Author

#298 was merged to master – closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants