dgs-codegen
dgs-codegen copied to clipboard
Add serializeCompact to GraphQLQueryRequest
Goal
While upgrading from graphql-dgs-codegen-client-core
to graphql-dgs-codegen-shared-core
, we encountered some issue because the way GraphQLQueryRequest
is serialized is slightly different. This PR allows GraphQLQueryRequest
to be serialized as compact which is a little bit closer to what we had before. It's IMO a little better when we want to log the query, it stays on one line.
Implementation
To keep backward compatibility with Java, I created a new method. If backward compatibility with java is not an issue, I could just do one method with a default param, something like:
fun serialize(compact: Boolean = true): String {
...
}
Testing
I feel like the unit test I added is enough, but let me know if you disagree with that, I can add more tests.
Changes are looking good to me.