Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

findBreakingChanges: Simplify type to string conversion #1902

Merged
merged 1 commit into from May 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 3 additions & 15 deletions src/utilities/findBreakingChanges.js
Expand Up @@ -227,7 +227,7 @@ function findArgChanges(
description:
`${oldType.name}.${fieldName} arg ` +
`${oldArgDef.name} has changed type from ` +
`${oldArgDef.type.toString()} to ${newArgDef.type.toString()}`,
`${String(oldArgDef.type)} to ${String(newArgDef.type)}`,
});
} else if (
oldArgDef.defaultValue !== undefined &&
Expand Down Expand Up @@ -335,17 +335,11 @@ function findFieldsThatChangedTypeOnObjectOrInterfaceTypes(
newFieldType,
);
if (!isSafe) {
const oldFieldTypeString = isNamedType(oldFieldType)
? oldFieldType.name
: oldFieldType.toString();
const newFieldTypeString = isNamedType(newFieldType)
? newFieldType.name
: newFieldType.toString();
breakingChanges.push({
type: BreakingChangeType.FIELD_CHANGED_KIND,
description:
`${typeName}.${fieldName} changed type from ` +
`${oldFieldTypeString} to ${newFieldTypeString}.`,
`${String(oldFieldType)} to ${String(newFieldType)}.`,
});
}
}
Expand Down Expand Up @@ -391,17 +385,11 @@ function findFieldsThatChangedTypeOnInputObjectTypes(
newFieldType,
);
if (!isSafe) {
const oldFieldTypeString = isNamedType(oldFieldType)
? oldFieldType.name
: oldFieldType.toString();
const newFieldTypeString = isNamedType(newFieldType)
? newFieldType.name
: newFieldType.toString();
breakingChanges.push({
type: BreakingChangeType.FIELD_CHANGED_KIND,
description:
`${typeName}.${fieldName} changed type from ` +
`${oldFieldTypeString} to ${newFieldTypeString}.`,
`${String(oldFieldType)} to ${String(newFieldType)}.`,
});
}
}
Expand Down