apollo-rs icon indicating copy to clipboard operation
apollo-rs copied to clipboard

semantic diff between graphql documents

Open lrlna opened this issue 2 years ago • 8 comments

There have been a few asks to be able to check whether two documents are semantically the same. Here are some things that I think would not matter when checking for equality:

  • order of definitions in a document
  • order of fields, enum values, union members
  • order of argument definitions, variables, input values
  • order of directives

Things like a definition having an extra field, or directive, or argument will result in inequality.

We'd probably want to implement this first on the parser, but then definitely extend to the compiler's HIR. Even implementing a super small formatting example with the compiler needed some equality checks. I think this would require a partial eq implementation on pretty much every one of our AST nodes, and I don't think we can generate them with the existing xtask codegen task and have to manage it manually.

lrlna avatar Nov 10 '22 13:11 lrlna