File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
src/main/java/graphql/schema/diffing Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 3737import static java .util .Collections .emptyList ;
3838import static java .util .Collections .singletonList ;
3939
40+ /**
41+ * We don't want to allow arbitrary schema changes. For example changing an Object type into a Scalar
42+ * is not something we want to consider.
43+ * <p>
44+ * We do this to make SchemaDiffings better understandable, but also to improve the overall runtime of
45+ * the algorithm. By restricting the possible mappings the Schema diffing algo is actually able to
46+ * finish in a reasonable time for real life inputs.
47+ * <p>
48+ *
49+ * We restrict the algo by calculating which mappings are possible for given vertex. This is later used in
50+ * {@link DiffImpl#calcLowerBoundMappingCost}.
51+ * While doing this we need to also ensure that there are the same amount of vertices in the same "context":
52+ * for example if the source graph has 3 Objects, the target graph needs to have 3 Objects. We achieve this by
53+ * adding "isolated vertices" as needed.
54+ */
4055@ Internal
4156public class PossibleMappingsCalculator {
4257 private final SchemaDiffingRunningCheck runningCheck ;
@@ -760,7 +775,7 @@ public VertexContextSegment(VertexContextSegment child) {
760775 public abstract boolean filter (Vertex vertex , SchemaGraph schemaGraph );
761776 }
762777
763- public class PossibleMappings {
778+ public static class PossibleMappings {
764779
765780 public Set <Vertex > allIsolatedSource = new LinkedHashSet <>();
766781 public Set <Vertex > allIsolatedTarget = new LinkedHashSet <>();
You can’t perform that action at this time.
0 commit comments