Skip to content

Commit

Permalink
Filter before error
Browse files Browse the repository at this point in the history
  • Loading branch information
rix0rrr committed Jul 3, 2023
1 parent 7cd03b5 commit 6025357
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions packages/@aws-cdk/cfnspec/build-tools/validate-evolution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ export async function validateSpecificationEvolution(specProducer: () => Promise
*/
function validatePropertyTypeNameConsistency(oldSpec: any, newSpec: any) {
const newPropsTypes = newSpec.PropertyTypes ?? {};
const disappearedKeys = Object.keys(oldSpec.PropertyTypes ?? {}).filter(k => !(k in newPropsTypes));
const disappearedKeys = Object.keys(oldSpec.PropertyTypes ?? {})
.filter(k => !(k in newPropsTypes))
// Marked as deleted on purpose
.filter(k => !(newSpec.DeletedPropertyTypes?.[k]));

if (disappearedKeys.length === 0) {
return;
}
Expand All @@ -70,14 +74,6 @@ function validatePropertyTypeNameConsistency(oldSpec: any, newSpec: any) {
for (const key of disappearedKeys) {
const [cfnResource, typeName] = key.split('.');
const usages = findTypeUsages(oldSpec, cfnResource, typeName);
if (usages.length === 0) {
// Might have disappeared, but no one should have been using this
continue;
}
if (newSpec.DeletedPropertyTypes?.[key]) {
// Marked as deleted on purpose
continue;
}

operations.push({
$comment: `If ${cfnResource}.${typeName} was renamed, use this and the 'replace's below. Remove this comment.`,
Expand Down

0 comments on commit 6025357

Please sign in to comment.