-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement more compatibility checks
This includes relations, references, key fields, collect fields, business objects and enum values
- Loading branch information
Showing
10 changed files
with
1,355 additions
and
149 deletions.
There are no files selected for viewing
1,025 changes: 899 additions & 126 deletions
1,025
spec/model/compatibility-check/check-model.spec.ts
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { EnumType } from '../implementation'; | ||
import { ValidationContext, ValidationMessage } from '../validation'; | ||
import { getRequiredBySuffix } from './describe-module-specification'; | ||
|
||
export function checkEnumType( | ||
typeToCheck: EnumType, | ||
baselineType: EnumType, | ||
context: ValidationContext, | ||
) { | ||
for (const baselineValue of baselineType.values) { | ||
const matchingValue = typeToCheck.values.find((v) => v.value === baselineValue.value); | ||
if (!matchingValue) { | ||
context.addMessage( | ||
ValidationMessage.compatibilityIssue( | ||
`Enum value "${baselineValue.value}" is missing${getRequiredBySuffix( | ||
baselineType, | ||
)}.`, | ||
typeToCheck.nameASTNode, | ||
), | ||
); | ||
continue; | ||
} | ||
} | ||
} |
Oops, something went wrong.