Skip to content

Commit

Permalink
fix(schema): Don't overwrite spec values with undefined (#1160)
Browse files Browse the repository at this point in the history
  • Loading branch information
cemalettin-work committed Dec 12, 2020
1 parent e785e1a commit 207aea7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,14 @@ export default abstract class BaseSchema<
let base = this;
let combined = schema.clone();

const mergedSpec = { ...base.spec, ...combined.spec };
const baseSpec = { ...base.spec };
// only overwrite with spec values which are not undefined
const mergedSpec = Object.keys(combined.spec).reduce((accum, key) => {
if (combined.spec[key] !== undefined){
accum[key] = combined.spec[key]
}
return accum;
}, baseSpec)

// if (combined.spec.nullable === UNSET)
// mergedSpec.nullable = base.spec.nullable;
Expand Down

0 comments on commit 207aea7

Please sign in to comment.