diff --git a/src/schema.ts b/src/schema.ts index 7ffaccd91..ff095ba96 100644 --- a/src/schema.ts +++ b/src/schema.ts @@ -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 override with spec values which are not undefine + 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;