@lucania/schema 1.0.3 → 1.0.4
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/build/index.js +4 -4
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -157,6 +157,9 @@
|
|
|
157
157
|
}
|
|
158
158
|
const result = _validate(schema.type, source, path, originalSchema, originalSource);
|
|
159
159
|
if (result instanceof ValidationError && result.type === "missing") {
|
|
160
|
+
if (!schema.required && source === undefined) {
|
|
161
|
+
return undefined;
|
|
162
|
+
}
|
|
160
163
|
if ("default" in schema) {
|
|
161
164
|
if (typeof schema.default === "function") {
|
|
162
165
|
return _validate(schema.type, schema.default(), path, originalSchema, originalSource);
|
|
@@ -165,10 +168,7 @@
|
|
|
165
168
|
return _validate(schema.type, schema.default, path, originalSchema, originalSource);
|
|
166
169
|
}
|
|
167
170
|
}
|
|
168
|
-
|
|
169
|
-
return result;
|
|
170
|
-
}
|
|
171
|
-
return undefined;
|
|
171
|
+
return result;
|
|
172
172
|
}
|
|
173
173
|
return result;
|
|
174
174
|
}
|