@beseif-solutions/prow-core 1.0.4 → 1.0.5

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.
@@ -458,7 +458,12 @@ const recursive_schema = async (field, data, options) => {
458
458
  const value = lodash_1.default.get(data, relativeKey, newField.default);
459
459
  const resolved = context_1.default.resolve(newField, value, options.context);
460
460
  if (!options.no_undefined || typeof resolved !== `undefined`) {
461
- lodash_1.default.set(data, relativeKey, resolved);
461
+ if (newField.type === `any` && typeof resolved === `undefined`) {
462
+ lodash_1.default.set(data, relativeKey, null);
463
+ }
464
+ else {
465
+ lodash_1.default.set(data, relativeKey, resolved);
466
+ }
462
467
  }
463
468
  if (typeof resolved === `undefined` && options.array) {
464
469
  return { schema: null, field: null };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beseif-solutions/prow-core",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Prow core functionalities and classes",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -507,7 +507,14 @@ const recursive_schema = async (field: Field, data: Record<string, any>, options
507
507
 
508
508
  // resolve value with context (even if it's not valid)
509
509
  const resolved = context.resolve(newField, value, options.context);
510
- if (!options.no_undefined || typeof resolved !== `undefined`) { _.set(data, relativeKey, resolved); }
510
+ if (!options.no_undefined || typeof resolved !== `undefined`) {
511
+ if (newField.type === `any` && typeof resolved === `undefined`) {
512
+ // any field - allow_nullish
513
+ _.set(data, relativeKey, null);
514
+ } else {
515
+ _.set(data, relativeKey, resolved);
516
+ }
517
+ }
511
518
 
512
519
  // omit undefined for array mappings
513
520
  if (typeof resolved === `undefined` && options.array) { return { schema: null, field: null }; }