Skip to content

SchemaDiff reports incorrect breakage count #2877

Closed

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.

Activity

  1. changed the title [-]SchemaDiff report incorrect breakage count[/-] [+]SchemaDiff reports incorrect breakage count[/+] on Jul 1, 2022
  2. added a commit that references this issue on Aug 25, 2022
  3. added this to the 20.0 milestone on Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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