Skip to content

Commit

Permalink
fix: Incorrect validation of extension types (#422)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickevansuk authored Apr 28, 2023
1 parent 5c46a00 commit db7ab5b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/rules/core/fields-not-in-model-rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,14 @@ module.exports = class FieldsNotInModelRule extends Rule {
if (field === '@context') {
return [];
}
// Don't do this check for cases where the JSON-LD type does not match the expected model
// Other rules will raise an error if the type itself is invalid, and if this type is an
// extension the validator cannot yet validate properties within the type anyway,
// so in either case this rule should not run.
// TODO: Remove this and improve the rule to validate beta and extension types
if (node.model.isJsonLd && node.model.type !== node.getValue('type')) {
return [];
}
let errors = [];
let testKey = null;
let messageValues;
Expand Down

0 comments on commit db7ab5b

Please sign in to comment.