Skip to content

SchemaDiff reports incorrect breakage count #2877

@NielsDoucet

Description

@NielsDoucet

Describe the bug
The SchemaDiff$CountingReporter reports a different breakingCount compared to the CapturingReporter.getBreakageCount().
I'm fairly certain its breakingCount field should be initialised with 0: https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/schema/diff/SchemaDiff.java#L73

To Reproduce
Given the following code:

var capturingReporter = new CapturingReporter();
var schemaDiff = new SchemaDiff();
var schema = <some GraphQLSchema>;

int breakingCount = schemaDiff.diffSchema(DiffSet.diffSet(schema, schema), capturingReporter);

System.out.println(breakingCount + " != " + capturingReporter.getBreakageCount());

this will print 1 != 0

This also means that if you use the return value of the schemaDiff method to assert no breaking changes with breakingCount == 0, this will always fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions