Skip to content

Commit 9f52d3f

Browse files
authored
fix: add descriptions for https options (#3250)
1 parent ee6a1a4 commit 9f52d3f

File tree

4 files changed

+166
-6
lines changed

4 files changed

+166
-6
lines changed

lib/options.json

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,12 @@
307307
"additionalProperties": false,
308308
"properties": {
309309
"passphrase": {
310-
"type": "string"
310+
"type": "string",
311+
"description": "Passphrase for a pfx file."
311312
},
312313
"requestCert": {
313-
"type": "boolean"
314+
"type": "boolean",
315+
"description": "Request for an SSL certificate."
314316
},
315317
"cacert": {
316318
"anyOf": [
@@ -320,7 +322,8 @@
320322
{
321323
"instanceof": "Buffer"
322324
}
323-
]
325+
],
326+
"description": "Path to an SSL CA certificate."
324327
},
325328
"key": {
326329
"anyOf": [
@@ -330,7 +333,8 @@
330333
{
331334
"instanceof": "Buffer"
332335
}
333-
]
336+
],
337+
"description": "Path to an SSL key."
334338
},
335339
"pfx": {
336340
"anyOf": [
@@ -340,7 +344,8 @@
340344
{
341345
"instanceof": "Buffer"
342346
}
343-
]
347+
],
348+
"description": "Path to an SSL pfx file."
344349
},
345350
"cert": {
346351
"anyOf": [
@@ -350,7 +355,8 @@
350355
{
351356
"instanceof": "Buffer"
352357
}
353-
]
358+
],
359+
"description": "Path to an SSL certificate."
354360
}
355361
}
356362
}

test/__snapshots__/validate-options.test.js.snap.webpack4

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,80 @@ exports[`options validate should throw an error on the "https" option with '' va
186186
object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? }"
187187
`;
188188

189+
exports[`options validate should throw an error on the "https" option with '{"cacert":true}' value 1`] = `
190+
"ValidationError: Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
191+
- configuration.https should be one of these:
192+
boolean | object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? }
193+
-> By default, dev-server will be served over HTTP. It can optionally be served over HTTP/2 with HTTPS. https://webpack.js.org/configuration/dev-server/#devserverhttps
194+
Details:
195+
* configuration.https.cacert should be one of these:
196+
string | Buffer
197+
-> Path to an SSL CA certificate.
198+
Details:
199+
* configuration.https.cacert should be a string.
200+
* configuration.https.cacert should be an instance of Buffer."
201+
`;
202+
203+
exports[`options validate should throw an error on the "https" option with '{"cert":true}' value 1`] = `
204+
"ValidationError: Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
205+
- configuration.https should be one of these:
206+
boolean | object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? }
207+
-> By default, dev-server will be served over HTTP. It can optionally be served over HTTP/2 with HTTPS. https://webpack.js.org/configuration/dev-server/#devserverhttps
208+
Details:
209+
* configuration.https.cert should be one of these:
210+
string | Buffer
211+
-> Path to an SSL certificate.
212+
Details:
213+
* configuration.https.cert should be a string.
214+
* configuration.https.cert should be an instance of Buffer."
215+
`;
216+
189217
exports[`options validate should throw an error on the "https" option with '{"foo":"bar"}' value 1`] = `
190218
"ValidationError: Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
191219
- configuration.https has an unknown property 'foo'. These properties are valid:
192220
object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? }"
193221
`;
194222

223+
exports[`options validate should throw an error on the "https" option with '{"key":10}' value 1`] = `
224+
"ValidationError: Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
225+
- configuration.https should be one of these:
226+
boolean | object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? }
227+
-> By default, dev-server will be served over HTTP. It can optionally be served over HTTP/2 with HTTPS. https://webpack.js.org/configuration/dev-server/#devserverhttps
228+
Details:
229+
* configuration.https.key should be one of these:
230+
string | Buffer
231+
-> Path to an SSL key.
232+
Details:
233+
* configuration.https.key should be a string.
234+
* configuration.https.key should be an instance of Buffer."
235+
`;
236+
237+
exports[`options validate should throw an error on the "https" option with '{"passphrase":false}' value 1`] = `
238+
"ValidationError: Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
239+
- configuration.https.passphrase should be a string.
240+
-> Passphrase for a pfx file."
241+
`;
242+
243+
exports[`options validate should throw an error on the "https" option with '{"pfx":10}' value 1`] = `
244+
"ValidationError: Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
245+
- configuration.https should be one of these:
246+
boolean | object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? }
247+
-> By default, dev-server will be served over HTTP. It can optionally be served over HTTP/2 with HTTPS. https://webpack.js.org/configuration/dev-server/#devserverhttps
248+
Details:
249+
* configuration.https.pfx should be one of these:
250+
string | Buffer
251+
-> Path to an SSL pfx file.
252+
Details:
253+
* configuration.https.pfx should be a string.
254+
* configuration.https.pfx should be an instance of Buffer."
255+
`;
256+
257+
exports[`options validate should throw an error on the "https" option with '{"requestCert":"test"}' value 1`] = `
258+
"ValidationError: Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
259+
- configuration.https.requestCert should be a boolean.
260+
-> Request for an SSL certificate."
261+
`;
262+
195263
exports[`options validate should throw an error on the "onAfterSetupMiddleware" option with 'false' value 1`] = `
196264
"ValidationError: Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
197265
- configuration.onAfterSetupMiddleware should be an instance of function.

test/__snapshots__/validate-options.test.js.snap.webpack5

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,80 @@ exports[`options validate should throw an error on the "https" option with '' va
186186
object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? }"
187187
`;
188188

189+
exports[`options validate should throw an error on the "https" option with '{"cacert":true}' value 1`] = `
190+
"ValidationError: Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
191+
- configuration.https should be one of these:
192+
boolean | object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? }
193+
-> By default, dev-server will be served over HTTP. It can optionally be served over HTTP/2 with HTTPS. https://webpack.js.org/configuration/dev-server/#devserverhttps
194+
Details:
195+
* configuration.https.cacert should be one of these:
196+
string | Buffer
197+
-> Path to an SSL CA certificate.
198+
Details:
199+
* configuration.https.cacert should be a string.
200+
* configuration.https.cacert should be an instance of Buffer."
201+
`;
202+
203+
exports[`options validate should throw an error on the "https" option with '{"cert":true}' value 1`] = `
204+
"ValidationError: Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
205+
- configuration.https should be one of these:
206+
boolean | object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? }
207+
-> By default, dev-server will be served over HTTP. It can optionally be served over HTTP/2 with HTTPS. https://webpack.js.org/configuration/dev-server/#devserverhttps
208+
Details:
209+
* configuration.https.cert should be one of these:
210+
string | Buffer
211+
-> Path to an SSL certificate.
212+
Details:
213+
* configuration.https.cert should be a string.
214+
* configuration.https.cert should be an instance of Buffer."
215+
`;
216+
189217
exports[`options validate should throw an error on the "https" option with '{"foo":"bar"}' value 1`] = `
190218
"ValidationError: Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
191219
- configuration.https has an unknown property 'foo'. These properties are valid:
192220
object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? }"
193221
`;
194222

223+
exports[`options validate should throw an error on the "https" option with '{"key":10}' value 1`] = `
224+
"ValidationError: Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
225+
- configuration.https should be one of these:
226+
boolean | object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? }
227+
-> By default, dev-server will be served over HTTP. It can optionally be served over HTTP/2 with HTTPS. https://webpack.js.org/configuration/dev-server/#devserverhttps
228+
Details:
229+
* configuration.https.key should be one of these:
230+
string | Buffer
231+
-> Path to an SSL key.
232+
Details:
233+
* configuration.https.key should be a string.
234+
* configuration.https.key should be an instance of Buffer."
235+
`;
236+
237+
exports[`options validate should throw an error on the "https" option with '{"passphrase":false}' value 1`] = `
238+
"ValidationError: Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
239+
- configuration.https.passphrase should be a string.
240+
-> Passphrase for a pfx file."
241+
`;
242+
243+
exports[`options validate should throw an error on the "https" option with '{"pfx":10}' value 1`] = `
244+
"ValidationError: Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
245+
- configuration.https should be one of these:
246+
boolean | object { passphrase?, requestCert?, cacert?, key?, pfx?, cert? }
247+
-> By default, dev-server will be served over HTTP. It can optionally be served over HTTP/2 with HTTPS. https://webpack.js.org/configuration/dev-server/#devserverhttps
248+
Details:
249+
* configuration.https.pfx should be one of these:
250+
string | Buffer
251+
-> Path to an SSL pfx file.
252+
Details:
253+
* configuration.https.pfx should be a string.
254+
* configuration.https.pfx should be an instance of Buffer."
255+
`;
256+
257+
exports[`options validate should throw an error on the "https" option with '{"requestCert":"test"}' value 1`] = `
258+
"ValidationError: Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
259+
- configuration.https.requestCert should be a boolean.
260+
-> Request for an SSL certificate."
261+
`;
262+
195263
exports[`options validate should throw an error on the "onAfterSetupMiddleware" option with 'false' value 1`] = `
196264
"ValidationError: Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
197265
- configuration.onAfterSetupMiddleware should be an instance of function.

test/validate-options.test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,24 @@ const tests = {
200200
{
201201
foo: 'bar',
202202
},
203+
{
204+
key: 10,
205+
},
206+
{
207+
cert: true,
208+
},
209+
{
210+
cacert: true,
211+
},
212+
{
213+
passphrase: false,
214+
},
215+
{
216+
pfx: 10,
217+
},
218+
{
219+
requestCert: 'test',
220+
},
203221
],
204222
},
205223
onListening: {

0 commit comments

Comments
 (0)