@invisibleloop/pulse 0.21.1 → 0.21.2
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/package.json +1 -1
- package/public/.pulse-ui-version +1 -1
- package/src/spec/schema.js +5 -4
package/package.json
CHANGED
package/public/.pulse-ui-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.21.
|
|
1
|
+
0.21.2
|
package/src/spec/schema.js
CHANGED
|
@@ -124,17 +124,18 @@
|
|
|
124
124
|
|
|
125
125
|
/**
|
|
126
126
|
* Validate a spec object against the schema.
|
|
127
|
-
* Returns { valid
|
|
127
|
+
* Returns { valid, errors, warnings } — `warnings` is always an array, including on the early
|
|
128
|
+
* returns (non-object spec, raw-response spec), because callers spread it.
|
|
128
129
|
*
|
|
129
130
|
* @param {unknown} spec
|
|
130
|
-
* @returns {{ valid: boolean, errors: string[] }}
|
|
131
|
+
* @returns {{ valid: boolean, errors: string[], warnings: string[] }}
|
|
131
132
|
*/
|
|
132
133
|
export function validateSpec(spec) {
|
|
133
134
|
const errors = []
|
|
134
135
|
const warnings = []
|
|
135
136
|
|
|
136
137
|
if (!spec || typeof spec !== 'object') {
|
|
137
|
-
return { valid: false, errors: ['Spec must be a plain object'] }
|
|
138
|
+
return { valid: false, errors: ['Spec must be a plain object'], warnings }
|
|
138
139
|
}
|
|
139
140
|
|
|
140
141
|
// route — '*' is the custom not-found page, rendered with status 404 when no route matches
|
|
@@ -191,7 +192,7 @@ export function validateSpec(spec) {
|
|
|
191
192
|
errors.push('spec.render is required when spec.contentType is set — (ctx, server) => string')
|
|
192
193
|
}
|
|
193
194
|
// Raw specs don't need state or view — skip those checks
|
|
194
|
-
return { valid: errors.length === 0, errors }
|
|
195
|
+
return { valid: errors.length === 0, errors, warnings }
|
|
195
196
|
}
|
|
196
197
|
|
|
197
198
|
// state
|