Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/main/java/graphql/schema/diff/DiffCategory.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ public enum DiffCategory {
*/
DIFFERENT,
/**
* The new API has deprecated something or removed something deprecated from the old API
* The new API has newly deprecated something
*/
DEPRECATED
DEPRECATION_ADDED,
/**
* The new API has removed something previously deprecated in the old API
*/
DEPRECATION_REMOVED,
}
10 changes: 5 additions & 5 deletions src/main/java/graphql/schema/diff/SchemaDiff.java
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ private void checkInputFields(DiffCtx ctx, TypeDefinition old, List<InputValueDe
DiffCategory category;
String message;
if (isDeprecated(oldField)) {
category = DiffCategory.DEPRECATED;
category = DiffCategory.DEPRECATION_REMOVED;
message = "The new API has removed a deprecated field '%s'";
} else {
category = DiffCategory.MISSING;
Expand Down Expand Up @@ -444,7 +444,7 @@ private void checkEnumType(DiffCtx ctx, EnumTypeDefinition oldDef, EnumTypeDefin
DiffCategory category;
String message;
if (isDeprecated(oldEnum)) {
category = DiffCategory.DEPRECATED;
category = DiffCategory.DEPRECATION_REMOVED;
message = "The new API has removed a deprecated enum value '%s'";
} else {
category = DiffCategory.MISSING;
Expand Down Expand Up @@ -474,7 +474,7 @@ private void checkEnumType(DiffCtx ctx, EnumTypeDefinition oldDef, EnumTypeDefin
.build());
} else if (isDeprecated(newDefinitionMap.get(enumName))) {
ctx.report(DiffEvent.apiDanger()
.category(DiffCategory.DEPRECATED)
.category(DiffCategory.DEPRECATION_ADDED)
.typeName(oldDef.getName())
.typeKind(getTypeKind(oldDef))
.components(enumName)
Expand Down Expand Up @@ -546,7 +546,7 @@ private void checkFieldRemovals(
DiffCategory category;
String message;
if (isDeprecated(entry.getValue())) {
category = DiffCategory.DEPRECATED;
category = DiffCategory.DEPRECATION_REMOVED;
message = "The new API has removed a deprecated field '%s'";
} else {
category = DiffCategory.MISSING;
Expand Down Expand Up @@ -592,7 +592,7 @@ private void checkFieldAdditions(
.build());
} else if (!isDeprecated(oldField) && isDeprecated(entry.getValue())) {
ctx.report(DiffEvent.apiDanger()
.category(DiffCategory.DEPRECATED)
.category(DiffCategory.DEPRECATION_ADDED)
.typeName(newDef.getName())
.typeKind(getTypeKind(newDef))
.fieldName(fieldName)
Expand Down
4 changes: 2 additions & 2 deletions src/test/groovy/graphql/schema/diff/SchemaDiffTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ class SchemaDiffTest extends Specification {
reporter.dangerCount == 13
reporter.breakageCount == 0
reporter.dangers.every {
it.getCategory() == DiffCategory.DEPRECATED
it.getCategory() == DiffCategory.DEPRECATION_ADDED
}

}
Expand All @@ -507,7 +507,7 @@ class SchemaDiffTest extends Specification {
reporter.dangerCount == 0
reporter.breakageCount == 11
reporter.breakages.every {
it.getCategory() == DiffCategory.DEPRECATED
it.getCategory() == DiffCategory.DEPRECATION_REMOVED
}
}

Expand Down