Skip to content

Commit

Permalink
fix: do not make "Field is missing" suppressable on type level
Browse files Browse the repository at this point in the history
It suppressed all missing fields, not just the one, which does not make
sense.
  • Loading branch information
Yogu committed Sep 12, 2024
1 parent f066a10 commit 2fc0d40
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/model/compatibility-check/check-object-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ export function checkObjectType(
);
}

// cannot easily make this suppressable - if we would accept a @suppress on the type,
// that would supress all missing fields, not just this one
context.addMessage(
ValidationMessage.suppressableCompatibilityIssue(
'MISSING_FIELD',
ValidationMessage.nonSuppressableCompatibilityIssue(
`Field "${baselineType.name}.${
baselineField.name
}" is missing${getRequiredBySuffix(baselineField)}.`,
typeToCheck.astNode,
{ location: typeToCheck.nameASTNode, quickFixes },
typeToCheck.nameASTNode ?? typeToCheck.astNode,
),
);
continue;
Expand Down
1 change: 0 additions & 1 deletion src/model/validation/suppress/message-codes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const COMPATIBILITY_ISSUE_CODES = {
DEFAULT_VALUE: 'Missing, superfluous or diverging @defaultValue',
MISSING_ENUM_VALUE: 'An enum declaration is missing a value',
FIELD_TYPE: 'A field has the wrong type',
MISSING_FIELD: 'An object type declaration is missing a field',
KEY_FIELD: 'Missing or superfluous @key',
REFERENCE: 'Missing, superfluous or diverging @reference',
RELATION: 'Missing, superfluous or diverging @relation',
Expand Down

0 comments on commit 2fc0d40

Please sign in to comment.