Skip to content

com2ghz/graphql-query-compare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

graphql-query-compare

Extension library for graphql-java to compare GraphQL queries and check them for equality. This is useful for testing purposes if you want to assert the GraphQL queries your application is making.

You can compare the queries on multiple levels:

  • Document level
  • Selection set
  • Fields
  • Arguments
  • Values

Usage:

Document firstDocument = parser.parseDocument(readQuery("equalquerywithdifferentorderoffields/query1.graphql"));
Document secondDocument = parser.parseDocument(readQuery("equalquerywithdifferentorderoffields/query2.graphql"));

DocumentCompare.isEqual(firstDocument, secondDocument);

So the following queries are considered equal:

query Query {
    vehicle(licenseplate: "AABBCC25", identification: "aaBBccDD1234") {
      brand
      year
      owner {
        firstName
        lastName
     }
  }
}
query Query {
vehicle(identification: "aaBBccDD1234", licenseplate: "AABBCC25") {
      owner {
        lastName
        firstName
     }
      year
      brand
  }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages