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

fix: update schema for index and methods properties #1397

Merged
merged 1 commit into from
Nov 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"type": "array",
"items": {
"type": "string",
"minlength": "1"
"minLength": 1
}
},
"headers": {
Expand Down Expand Up @@ -116,7 +116,7 @@
},
{
"type": "string",
"minlength": "1"
"minLength": 1
}
]
}
Expand Down
12 changes: 6 additions & 6 deletions test/__snapshots__/validation-options.test.js.snap.webpack5
Original file line number Diff line number Diff line change
Expand Up @@ -42,37 +42,37 @@ exports[`validation should throw an error on the "headers" option with "true" va
exports[`validation should throw an error on the "index" option with "{}" value 1`] = `
"Invalid options object. Dev Middleware has been initialized using an options object that does not match the API schema.
- options.index should be one of these:
boolean | string
boolean | non-empty string
-> Allows to serve an index of the directory.
-> Read more at https://github.com/webpack/webpack-dev-middleware#index
Details:
* options.index should be a boolean.
* options.index should be a string."
* options.index should be a non-empty string."
`;

exports[`validation should throw an error on the "index" option with "0" value 1`] = `
"Invalid options object. Dev Middleware has been initialized using an options object that does not match the API schema.
- options.index should be one of these:
boolean | string
boolean | non-empty string
-> Allows to serve an index of the directory.
-> Read more at https://github.com/webpack/webpack-dev-middleware#index
Details:
* options.index should be a boolean.
* options.index should be a string."
* options.index should be a non-empty string."
`;

exports[`validation should throw an error on the "methods" option with "{}" value 1`] = `
"Invalid options object. Dev Middleware has been initialized using an options object that does not match the API schema.
- options.methods should be an array:
[string, ...]
[non-empty string, ...]
-> Allows to pass the list of HTTP request methods accepted by the middleware.
-> Read more at https://github.com/webpack/webpack-dev-middleware#methods"
`;

exports[`validation should throw an error on the "methods" option with "true" value 1`] = `
"Invalid options object. Dev Middleware has been initialized using an options object that does not match the API schema.
- options.methods should be an array:
[string, ...]
[non-empty string, ...]
-> Allows to pass the list of HTTP request methods accepted by the middleware.
-> Read more at https://github.com/webpack/webpack-dev-middleware#methods"
`;
Expand Down