Skip to content

Commit 6d7e50e

Browse files
author
Faizan Siddiqui
committed
add directiveName as property to AppliedDirectiveLocationDetail
1 parent a54bb43 commit 6d7e50e

File tree

2 files changed

+116
-37
lines changed

2 files changed

+116
-37
lines changed

src/main/java/graphql/schema/diffing/ana/EditOperationAnalyzer.java

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -244,31 +244,31 @@ private void appliedDirectiveDeleted(EditOperation editOperation) {
244244
if (isObjectDeleted(object.getName())) {
245245
return;
246246
}
247-
AppliedDirectiveObjectLocation location = new AppliedDirectiveObjectLocation(object.getName());
247+
AppliedDirectiveObjectLocation location = new AppliedDirectiveObjectLocation(object.getName(), appliedDirective.getName());
248248
AppliedDirectiveDeletion appliedDirectiveDeletion = new AppliedDirectiveDeletion(location, appliedDirective.getName());
249249
getObjectModification(object.getName()).getDetails().add(appliedDirectiveDeletion);
250250
} else if (container.isOfType(SchemaGraph.INTERFACE)) {
251251
Vertex interfaze = container;
252252
if (isInterfaceDeleted(interfaze.getName())) {
253253
return;
254254
}
255-
AppliedDirectiveInterfaceLocation location = new AppliedDirectiveInterfaceLocation(interfaze.getName());
255+
AppliedDirectiveInterfaceLocation location = new AppliedDirectiveInterfaceLocation(interfaze.getName(), appliedDirective.getName());
256256
AppliedDirectiveDeletion appliedDirectiveDeletion = new AppliedDirectiveDeletion(location, appliedDirective.getName());
257257
getInterfaceModification(interfaze.getName()).getDetails().add(appliedDirectiveDeletion);
258258
} else if (container.isOfType(SchemaGraph.SCALAR)) {
259259
Vertex scalar = container;
260260
if (isScalarDeleted(scalar.getName())) {
261261
return;
262262
}
263-
AppliedDirectiveScalarLocation location = new AppliedDirectiveScalarLocation(scalar.getName());
263+
AppliedDirectiveScalarLocation location = new AppliedDirectiveScalarLocation(scalar.getName(), appliedDirective.getName());
264264
AppliedDirectiveDeletion appliedDirectiveDeletion = new AppliedDirectiveDeletion(location, appliedDirective.getName());
265265
getScalarModification(scalar.getName()).getDetails().add(appliedDirectiveDeletion);
266266
} else if (container.isOfType(SchemaGraph.ENUM)) {
267267
Vertex enumVertex = container;
268268
if (isEnumDeleted(enumVertex.getName())) {
269269
return;
270270
}
271-
AppliedDirectiveEnumLocation location = new AppliedDirectiveEnumLocation(enumVertex.getName());
271+
AppliedDirectiveEnumLocation location = new AppliedDirectiveEnumLocation(enumVertex.getName(), appliedDirective.getName());
272272
AppliedDirectiveDeletion appliedDirectiveDeletion = new AppliedDirectiveDeletion(location, appliedDirective.getName());
273273
getEnumModification(enumVertex.getName()).getDetails().add(appliedDirectiveDeletion);
274274
} else if (container.isOfType(SchemaGraph.ENUM_VALUE)) {
@@ -280,15 +280,15 @@ private void appliedDirectiveDeleted(EditOperation editOperation) {
280280
if (isEnumValueDeletedFromExistingEnum(enumVertex.getName(), enumValue.getName())) {
281281
return;
282282
}
283-
AppliedDirectiveEnumValueLocation location = new AppliedDirectiveEnumValueLocation(enumVertex.getName(), enumValue.getName());
283+
AppliedDirectiveEnumValueLocation location = new AppliedDirectiveEnumValueLocation(enumVertex.getName(), enumValue.getName(), appliedDirective.getName());
284284
AppliedDirectiveDeletion appliedDirectiveDeletion = new AppliedDirectiveDeletion(location, appliedDirective.getName());
285285
getEnumModification(enumVertex.getName()).getDetails().add(appliedDirectiveDeletion);
286286
} else if (container.isOfType(SchemaGraph.INPUT_OBJECT)) {
287287
Vertex inputObject = container;
288288
if (isInputObjectDeleted(inputObject.getName())) {
289289
return;
290290
}
291-
AppliedDirectiveInputObjectLocation location = new AppliedDirectiveInputObjectLocation(inputObject.getName());
291+
AppliedDirectiveInputObjectLocation location = new AppliedDirectiveInputObjectLocation(inputObject.getName(), appliedDirective.getName());
292292
AppliedDirectiveDeletion appliedDirectiveDeletion = new AppliedDirectiveDeletion(location, appliedDirective.getName());
293293
getInputObjectModification(inputObject.getName()).getDetails().add(appliedDirectiveDeletion);
294294
} else if (container.isOfType(SchemaGraph.INPUT_FIELD)) {
@@ -300,15 +300,15 @@ private void appliedDirectiveDeleted(EditOperation editOperation) {
300300
if (isInputFieldDeletedFromExistingInputObject(inputObject.getName(), inputField.getName())) {
301301
return;
302302
}
303-
AppliedDirectiveInputObjectFieldLocation location = new AppliedDirectiveInputObjectFieldLocation(inputObject.getName(), inputField.getName());
303+
AppliedDirectiveInputObjectFieldLocation location = new AppliedDirectiveInputObjectFieldLocation(inputObject.getName(), inputField.getName(), appliedDirective.getName());
304304
AppliedDirectiveDeletion appliedDirectiveDeletion = new AppliedDirectiveDeletion(location, appliedDirective.getName());
305305
getInputObjectModification(inputObject.getName()).getDetails().add(appliedDirectiveDeletion);
306306
} else if (container.isOfType(SchemaGraph.UNION)) {
307307
Vertex union = container;
308308
if (isUnionDeleted(union.getName())) {
309309
return;
310310
}
311-
AppliedDirectiveUnionLocation location = new AppliedDirectiveUnionLocation(union.getName());
311+
AppliedDirectiveUnionLocation location = new AppliedDirectiveUnionLocation(union.getName(), appliedDirective.getName());
312312
AppliedDirectiveDeletion appliedDirectiveDeletion = new AppliedDirectiveDeletion(location, appliedDirective.getName());
313313
getUnionModification(union.getName()).getDetails().add(appliedDirectiveDeletion);
314314
}
@@ -327,15 +327,15 @@ private void appliedDirectiveArgumentDeleted(EditOperation editOperation) {
327327
if (isObjectDeleted(object.getName())) {
328328
return;
329329
}
330-
AppliedDirectiveObjectFieldLocation location = new AppliedDirectiveObjectFieldLocation(object.getName(), field.getName());
330+
AppliedDirectiveObjectFieldLocation location = new AppliedDirectiveObjectFieldLocation(object.getName(), field.getName(), appliedDirective.getName());
331331
getObjectModification(object.getName()).getDetails().add(new AppliedDirectiveArgumentDeletion(location, deletedArgument.getName()));
332332
} else {
333333
assertTrue(interfaceOrObjective.isOfType(SchemaGraph.INTERFACE));
334334
Vertex interfaze = interfaceOrObjective;
335335
if (isInterfaceDeleted(interfaze.getName())) {
336336
return;
337337
}
338-
AppliedDirectiveInterfaceFieldLocation location = new AppliedDirectiveInterfaceFieldLocation(interfaze.getName(), field.getName());
338+
AppliedDirectiveInterfaceFieldLocation location = new AppliedDirectiveInterfaceFieldLocation(interfaze.getName(), field.getName(), appliedDirective.getName());
339339
getInterfaceModification(interfaze.getName()).getDetails().add(new AppliedDirectiveArgumentDeletion(location, deletedArgument.getName()));
340340
}
341341
}
@@ -359,7 +359,7 @@ private void appliedDirectiveArgumentChanged(EditOperation editOperation) {
359359
Vertex interfaceOrObjective = newSchemaGraph.getFieldsContainerForField(field);
360360
if (interfaceOrObjective.isOfType(SchemaGraph.OBJECT)) {
361361
Vertex object = interfaceOrObjective;
362-
AppliedDirectiveObjectFieldLocation location = new AppliedDirectiveObjectFieldLocation(object.getName(), field.getName());
362+
AppliedDirectiveObjectFieldLocation location = new AppliedDirectiveObjectFieldLocation(object.getName(), field.getName(), appliedDirective.getName());
363363
if (valueChanged) {
364364
AppliedDirectiveArgumentValueModification argumentValueModification = new AppliedDirectiveArgumentValueModification(location, newArgumentName, oldValue, newValue);
365365
getObjectModification(object.getName()).getDetails().add(argumentValueModification);
@@ -385,31 +385,31 @@ private void appliedDirectiveAdded(EditOperation editOperation) {
385385
if (isObjectAdded(object.getName())) {
386386
return;
387387
}
388-
AppliedDirectiveObjectLocation location = new AppliedDirectiveObjectLocation(object.getName());
388+
AppliedDirectiveObjectLocation location = new AppliedDirectiveObjectLocation(object.getName(), appliedDirective.getName());
389389
AppliedDirectiveAddition appliedDirectiveAddition = new AppliedDirectiveAddition(location, appliedDirective.getName());
390390
getObjectModification(object.getName()).getDetails().add(appliedDirectiveAddition);
391391
} else if (container.isOfType(SchemaGraph.INTERFACE)) {
392392
Vertex interfaze = container;
393393
if (isInterfaceAdded(interfaze.getName())) {
394394
return;
395395
}
396-
AppliedDirectiveInterfaceLocation location = new AppliedDirectiveInterfaceLocation(interfaze.getName());
396+
AppliedDirectiveInterfaceLocation location = new AppliedDirectiveInterfaceLocation(interfaze.getName(), appliedDirective.getName());
397397
AppliedDirectiveAddition appliedDirectiveAddition = new AppliedDirectiveAddition(location, appliedDirective.getName());
398398
getInterfaceModification(interfaze.getName()).getDetails().add(appliedDirectiveAddition);
399399
} else if (container.isOfType(SchemaGraph.SCALAR)) {
400400
Vertex scalar = container;
401401
if (isScalarAdded(scalar.getName())) {
402402
return;
403403
}
404-
AppliedDirectiveScalarLocation location = new AppliedDirectiveScalarLocation(scalar.getName());
404+
AppliedDirectiveScalarLocation location = new AppliedDirectiveScalarLocation(scalar.getName(), appliedDirective.getName());
405405
AppliedDirectiveAddition appliedDirectiveAddition = new AppliedDirectiveAddition(location, appliedDirective.getName());
406406
getScalarModification(scalar.getName()).getDetails().add(appliedDirectiveAddition);
407407
} else if (container.isOfType(SchemaGraph.ENUM)) {
408408
Vertex enumVertex = container;
409409
if (isEnumAdded(enumVertex.getName())) {
410410
return;
411411
}
412-
AppliedDirectiveEnumLocation location = new AppliedDirectiveEnumLocation(enumVertex.getName());
412+
AppliedDirectiveEnumLocation location = new AppliedDirectiveEnumLocation(enumVertex.getName(), appliedDirective.getName());
413413
AppliedDirectiveAddition appliedDirectiveAddition = new AppliedDirectiveAddition(location, appliedDirective.getName());
414414
getEnumModification(enumVertex.getName()).getDetails().add(appliedDirectiveAddition);
415415
} else if (container.isOfType(SchemaGraph.ENUM_VALUE)) {
@@ -421,15 +421,15 @@ private void appliedDirectiveAdded(EditOperation editOperation) {
421421
if (isNewEnumValueForExistingEnum(enumVertex.getName(), enumValue.getName())) {
422422
return;
423423
}
424-
AppliedDirectiveEnumValueLocation location = new AppliedDirectiveEnumValueLocation(enumVertex.getName(), enumValue.getName());
424+
AppliedDirectiveEnumValueLocation location = new AppliedDirectiveEnumValueLocation(enumVertex.getName(), enumValue.getName(), appliedDirective.getName());
425425
AppliedDirectiveAddition appliedDirectiveAddition = new AppliedDirectiveAddition(location, appliedDirective.getName());
426426
getEnumModification(enumVertex.getName()).getDetails().add(appliedDirectiveAddition);
427427
} else if (container.isOfType(SchemaGraph.INPUT_OBJECT)) {
428428
Vertex inputObject = container;
429429
if (isInputObjectAdded(inputObject.getName())) {
430430
return;
431431
}
432-
AppliedDirectiveInputObjectLocation location = new AppliedDirectiveInputObjectLocation(inputObject.getName());
432+
AppliedDirectiveInputObjectLocation location = new AppliedDirectiveInputObjectLocation(inputObject.getName(), appliedDirective.getName());
433433
AppliedDirectiveAddition appliedDirectiveAddition = new AppliedDirectiveAddition(location, appliedDirective.getName());
434434
getInputObjectModification(inputObject.getName()).getDetails().add(appliedDirectiveAddition);
435435
} else if (container.isOfType(SchemaGraph.INPUT_FIELD)) {
@@ -441,15 +441,15 @@ private void appliedDirectiveAdded(EditOperation editOperation) {
441441
if (isNewInputFieldExistingInputObject(inputObject.getName(), inputField.getName())) {
442442
return;
443443
}
444-
AppliedDirectiveInputObjectFieldLocation location = new AppliedDirectiveInputObjectFieldLocation(inputObject.getName(), inputField.getName());
444+
AppliedDirectiveInputObjectFieldLocation location = new AppliedDirectiveInputObjectFieldLocation(inputObject.getName(), inputField.getName(), appliedDirective.getName());
445445
AppliedDirectiveAddition appliedDirectiveAddition = new AppliedDirectiveAddition(location, appliedDirective.getName());
446446
getInputObjectModification(inputObject.getName()).getDetails().add(appliedDirectiveAddition);
447447
} else if (container.isOfType(SchemaGraph.UNION)) {
448448
Vertex union = container;
449449
if (isUnionAdded(union.getName())) {
450450
return;
451451
}
452-
AppliedDirectiveUnionLocation location = new AppliedDirectiveUnionLocation(union.getName());
452+
AppliedDirectiveUnionLocation location = new AppliedDirectiveUnionLocation(union.getName(), appliedDirective.getName());
453453
AppliedDirectiveAddition appliedDirectiveAddition = new AppliedDirectiveAddition(location, appliedDirective.getName());
454454
getUnionModification(union.getName()).getDetails().add(appliedDirectiveAddition);
455455
}
@@ -467,7 +467,7 @@ private void appliedDirectiveDeletedFromField(Vertex appliedDirective, Vertex co
467467
if (isFieldDeletedFromExistingObject(object.getName(), field.getName())) {
468468
return;
469469
}
470-
AppliedDirectiveObjectFieldLocation location = new AppliedDirectiveObjectFieldLocation(object.getName(), field.getName());
470+
AppliedDirectiveObjectFieldLocation location = new AppliedDirectiveObjectFieldLocation(object.getName(), field.getName(), appliedDirective.getName());
471471
AppliedDirectiveDeletion appliedDirectiveDeletion = new AppliedDirectiveDeletion(location, appliedDirective.getName());
472472
getObjectModification(object.getName()).getDetails().add(appliedDirectiveDeletion);
473473
}
@@ -485,7 +485,7 @@ private void appliedDirectiveAddedToField(Vertex appliedDirective, Vertex contai
485485
if (isFieldNewForExistingObject(object.getName(), field.getName())) {
486486
return;
487487
}
488-
AppliedDirectiveObjectFieldLocation location = new AppliedDirectiveObjectFieldLocation(object.getName(), field.getName());
488+
AppliedDirectiveObjectFieldLocation location = new AppliedDirectiveObjectFieldLocation(object.getName(), field.getName(), appliedDirective.getName());
489489
AppliedDirectiveAddition appliedDirectiveAddition = new AppliedDirectiveAddition(location, appliedDirective.getName());
490490
getObjectModification(object.getName()).getDetails().add(appliedDirectiveAddition);
491491
}
@@ -508,7 +508,7 @@ private void appliedDirectiveDeletedFromArgument(Vertex appliedDirective, Vertex
508508
if (isArgumentDeletedFromExistingObjectField(object.getName(), field.getName(), argument.getName())) {
509509
return;
510510
}
511-
AppliedDirectiveObjectFieldArgumentLocation location = new AppliedDirectiveObjectFieldArgumentLocation(object.getName(), field.getName(), argument.getName());
511+
AppliedDirectiveObjectFieldArgumentLocation location = new AppliedDirectiveObjectFieldArgumentLocation(object.getName(), field.getName(), argument.getName(), appliedDirective.getName());
512512
AppliedDirectiveDeletion appliedDirectiveDeletion = new AppliedDirectiveDeletion(location, appliedDirective.getName());
513513
getObjectModification(object.getName()).getDetails().add(appliedDirectiveDeletion);
514514
} else {
@@ -523,7 +523,7 @@ private void appliedDirectiveDeletedFromArgument(Vertex appliedDirective, Vertex
523523
if (isArgumentDeletedFromExistingInterfaceField(interfaze.getName(), field.getName(), argument.getName())) {
524524
return;
525525
}
526-
AppliedDirectiveInterfaceFieldArgumentLocation location = new AppliedDirectiveInterfaceFieldArgumentLocation(interfaze.getName(), field.getName(), argument.getName());
526+
AppliedDirectiveInterfaceFieldArgumentLocation location = new AppliedDirectiveInterfaceFieldArgumentLocation(interfaze.getName(), field.getName(), argument.getName(), appliedDirective.getName());
527527
AppliedDirectiveDeletion appliedDirectiveDeletion = new AppliedDirectiveDeletion(location, appliedDirective.getName());
528528
getInterfaceModification(interfaze.getName()).getDetails().add(appliedDirectiveDeletion);
529529
}
@@ -559,7 +559,7 @@ private void appliedDirectiveAddedToArgument(Vertex appliedDirective, Vertex con
559559
if (isArgumentNewForExistingObjectField(object.getName(), field.getName(), argument.getName())) {
560560
return;
561561
}
562-
AppliedDirectiveObjectFieldArgumentLocation location = new AppliedDirectiveObjectFieldArgumentLocation(object.getName(), field.getName(), argument.getName());
562+
AppliedDirectiveObjectFieldArgumentLocation location = new AppliedDirectiveObjectFieldArgumentLocation(object.getName(), field.getName(), argument.getName(), appliedDirective.getName());
563563
AppliedDirectiveAddition appliedDirectiveAddition = new AppliedDirectiveAddition(location, appliedDirective.getName());
564564
getObjectModification(object.getName()).getDetails().add(appliedDirectiveAddition);
565565
} else {
@@ -574,7 +574,7 @@ private void appliedDirectiveAddedToArgument(Vertex appliedDirective, Vertex con
574574
if (isArgumentNewForExistingInterfaceField(interfaze.getName(), field.getName(), argument.getName())) {
575575
return;
576576
}
577-
AppliedDirectiveInterfaceFieldArgumentLocation location = new AppliedDirectiveInterfaceFieldArgumentLocation(interfaze.getName(), field.getName(), argument.getName());
577+
AppliedDirectiveInterfaceFieldArgumentLocation location = new AppliedDirectiveInterfaceFieldArgumentLocation(interfaze.getName(), field.getName(), argument.getName(), appliedDirective.getName());
578578
AppliedDirectiveAddition appliedDirectiveAddition = new AppliedDirectiveAddition(location, appliedDirective.getName());
579579
getInterfaceModification(interfaze.getName()).getDetails().add(appliedDirectiveAddition);
580580
}

0 commit comments

Comments
 (0)