|
8 | 8 | import graphql.schema.diffing.Mapping; |
9 | 9 | import graphql.schema.diffing.SchemaGraph; |
10 | 10 | import graphql.schema.diffing.Vertex; |
11 | | -import graphql.schema.diffing.ana.SchemaDifference.AppliedDirectiveArgumentRename; |
12 | | -import graphql.schema.diffing.ana.SchemaDifference.AppliedDirectiveObjectLocation; |
13 | 11 | import graphql.schema.idl.ScalarInfo; |
14 | 12 |
|
15 | 13 | import java.util.LinkedHashMap; |
|
19 | 17 | import static graphql.Assert.assertTrue; |
20 | 18 | import static graphql.schema.diffing.ana.SchemaDifference.AppliedDirectiveAddition; |
21 | 19 | import static graphql.schema.diffing.ana.SchemaDifference.AppliedDirectiveArgumentDeletion; |
| 20 | +import static graphql.schema.diffing.ana.SchemaDifference.AppliedDirectiveArgumentRename; |
22 | 21 | import static graphql.schema.diffing.ana.SchemaDifference.AppliedDirectiveArgumentValueModification; |
23 | 22 | import static graphql.schema.diffing.ana.SchemaDifference.AppliedDirectiveDeletion; |
24 | 23 | import static graphql.schema.diffing.ana.SchemaDifference.AppliedDirectiveDirectiveArgumentLocation; |
|
31 | 30 | import static graphql.schema.diffing.ana.SchemaDifference.AppliedDirectiveInterfaceLocation; |
32 | 31 | import static graphql.schema.diffing.ana.SchemaDifference.AppliedDirectiveObjectFieldArgumentLocation; |
33 | 32 | import static graphql.schema.diffing.ana.SchemaDifference.AppliedDirectiveObjectFieldLocation; |
| 33 | +import static graphql.schema.diffing.ana.SchemaDifference.AppliedDirectiveObjectLocation; |
34 | 34 | import static graphql.schema.diffing.ana.SchemaDifference.AppliedDirectiveScalarLocation; |
35 | 35 | import static graphql.schema.diffing.ana.SchemaDifference.AppliedDirectiveUnionLocation; |
36 | 36 | import static graphql.schema.diffing.ana.SchemaDifference.DirectiveAddition; |
|
48 | 48 | import static graphql.schema.diffing.ana.SchemaDifference.EnumModification; |
49 | 49 | import static graphql.schema.diffing.ana.SchemaDifference.EnumValueAddition; |
50 | 50 | import static graphql.schema.diffing.ana.SchemaDifference.EnumValueDeletion; |
| 51 | +import static graphql.schema.diffing.ana.SchemaDifference.EnumValueRenamed; |
51 | 52 | import static graphql.schema.diffing.ana.SchemaDifference.InputObjectAddition; |
52 | 53 | import static graphql.schema.diffing.ana.SchemaDifference.InputObjectDeletion; |
53 | 54 | import static graphql.schema.diffing.ana.SchemaDifference.InputObjectDifference; |
@@ -336,11 +337,9 @@ private void appliedDirectiveArgumentChanged(EditOperation editOperation) { |
336 | 337 | if (nameChanged) { |
337 | 338 | AppliedDirectiveArgumentRename argumentRename = new AppliedDirectiveArgumentRename(location, oldArgumentName, newArgumentName); |
338 | 339 | getObjectModification(object.getName()).getDetails().add(argumentRename); |
339 | | - |
340 | 340 | } |
341 | 341 | } |
342 | 342 | } |
343 | | - |
344 | 343 | } |
345 | 344 |
|
346 | 345 | private void appliedDirectiveAdded(EditOperation editOperation) { |
@@ -616,6 +615,11 @@ private void handleEnumValuesChanges(List<EditOperation> editOperations, Mapping |
616 | 615 | handleEnumValueDeleted(editOperation); |
617 | 616 | } |
618 | 617 | break; |
| 618 | + case CHANGE_VERTEX: |
| 619 | + if (editOperation.getSourceVertex().isOfType(SchemaGraph.ENUM_VALUE) && editOperation.getTargetVertex().isOfType(SchemaGraph.ENUM_VALUE)) { |
| 620 | + handleEnumValueChanged(editOperation); |
| 621 | + } |
| 622 | + break; |
619 | 623 | } |
620 | 624 | } |
621 | 625 | } |
@@ -724,6 +728,13 @@ private void handleEnumValueDeleted(EditOperation editOperation) { |
724 | 728 | enumModification.getDetails().add(new EnumValueDeletion(value.getName())); |
725 | 729 | } |
726 | 730 |
|
| 731 | + private void handleEnumValueChanged(EditOperation editOperation) { |
| 732 | + Vertex enumVertex = newSchemaGraph.getEnumForEnumValue(editOperation.getTargetVertex()); |
| 733 | + EnumModification enumModification = getEnumModification(enumVertex.getName()); |
| 734 | + String oldName = editOperation.getSourceVertex().getName(); |
| 735 | + String newName = editOperation.getTargetVertex().getName(); |
| 736 | + enumModification.getDetails().add(new EnumValueRenamed(oldName, newName)); |
| 737 | + } |
727 | 738 |
|
728 | 739 | private void fieldChanged(EditOperation editOperation) { |
729 | 740 | Vertex field = editOperation.getTargetVertex(); |
|
0 commit comments