diff --git a/CHANGELOG.md b/CHANGELOG.md index 84bd9df0ad..bb00f0bb6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ * added option to pass custom context for the decorators +### Fixes + +* validating against a schema will validate against that one instead of every registered one + ### 0.9.0 [BREAKING CHANGE] #### Features diff --git a/src/metadata/MetadataStorage.ts b/src/metadata/MetadataStorage.ts index 26a22be899..4e2bd4c8a7 100644 --- a/src/metadata/MetadataStorage.ts +++ b/src/metadata/MetadataStorage.ts @@ -77,7 +77,8 @@ export class MetadataStorage { // get metadatas for inherited classes const inheritedMetadatas = this.validationMetadatas.filter(metadata => { - if (typeof metadata.target === "string") + // if target is a string it's means we validate agains a schema, and there is no inheritance support for schemas + if (typeof metadata.target === "string") return false; if (metadata.target === targetConstructor) return false;