dsh-moli 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +22 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -27,7 +27,17 @@ const DEFAULTS = {
|
|
|
27
27
|
insecureTls: true,
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Parameter schema of `moli_fetch`.
|
|
32
|
+
*
|
|
33
|
+
* The two schema layers follow DIFFERENT rules, which is easy to get wrong:
|
|
34
|
+
* - A parameter spec uses the author DSL, where a property-level `required: true`
|
|
35
|
+
* is correct. `parameterSchemaSpecToJsonSchema` hoists it into an object-level
|
|
36
|
+
* `required` array and strips the flag.
|
|
37
|
+
* - A raw output schema is validated as-is, so `required` there must already be an
|
|
38
|
+
* object-level array of names. A property-level `required: true` makes the
|
|
39
|
+
* registry reject the whole tool with `JsonSchemaError`.
|
|
40
|
+
*/
|
|
31
41
|
const FETCH_PARAMETERS = {
|
|
32
42
|
url: { type: 'string', required: true, description: 'Absolute http:// or https:// URL to fetch.' },
|
|
33
43
|
dump: {
|
|
@@ -65,13 +75,20 @@ const FETCH_PARAMETERS = {
|
|
|
65
75
|
cookieFile: { type: 'string', description: 'Netscape/curl cookie-jar file to send.' },
|
|
66
76
|
};
|
|
67
77
|
|
|
78
|
+
/**
|
|
79
|
+
* `required` is an object-level array of property names in the registry's schema
|
|
80
|
+
* subset for a RAW schema. A property-level `required: true` belongs to the
|
|
81
|
+
* parameter DSL instead; here it makes the registry reject the tool.
|
|
82
|
+
*/
|
|
83
|
+
|
|
68
84
|
/** Result schema of `moli_fetch`; only `ok` and `url` are always present. */
|
|
69
85
|
const FETCH_OUTPUT_SCHEMA = {
|
|
70
86
|
type: 'object',
|
|
71
87
|
additionalProperties: true,
|
|
88
|
+
required: ['ok', 'url'],
|
|
72
89
|
properties: {
|
|
73
|
-
ok: { type: 'boolean'
|
|
74
|
-
url: { type: 'string'
|
|
90
|
+
ok: { type: 'boolean' },
|
|
91
|
+
url: { type: 'string' },
|
|
75
92
|
kind: { type: 'string', enum: ['text', 'binary'] },
|
|
76
93
|
dump: { type: 'string' },
|
|
77
94
|
content: { type: 'string' },
|
|
@@ -93,8 +110,9 @@ const FETCH_OUTPUT_SCHEMA = {
|
|
|
93
110
|
const PROBE_OUTPUT_SCHEMA = {
|
|
94
111
|
type: 'object',
|
|
95
112
|
additionalProperties: true,
|
|
113
|
+
required: ['installed'],
|
|
96
114
|
properties: {
|
|
97
|
-
installed: { type: 'boolean'
|
|
115
|
+
installed: { type: 'boolean' },
|
|
98
116
|
exe: { type: 'string' },
|
|
99
117
|
version: { type: 'string' },
|
|
100
118
|
httpsOk: { type: 'boolean' },
|
package/package.json
CHANGED