Use _bramble__typename
alias for bramble injected __typename
#105
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Following on from the work in #94. With that change in place there are certain aliases that are reserved for bramble's internal use, this changes the
__typename
alias to be_bramble__typename
.Rationale
_bramble
__typename
alias for different purposes being unable to do so__typename
field or bramble injected itAs a side note, any bramble injected fields (that were also not explicitly requested) are automatically omitted from the final response. This is because the response formatting uses the client's selection set to decide what goes into the response. Also, in the future we could consider failing queries that include the reserved aliases entirely.
New Test Suite
On top of the above changes there is a new minimal test suite, designed to test much more of bramble's internals in one go. The main difference between these tests and the tests in
execution_test.go
is the new suite will bring up and query real graphql servers. The tests are inserver_test.go
and the test server implementations in a packagetestsrv
.Given these servers are not mocked out there is a high overhead to new schemas and changes to what they now have. So the tests against them are minimal for now.
The biggest benefit of these tests is testing the plan against spec compliant graphql servers. The existing tests rely on manually crafted JSON to use as graphql responses and so don't test the plan itself but rather what the person writing the tests thinks it should be. Manually writing JSON is also fairly error prone and can cause frustrating test failures.
They also give us a quick end to end test that makes sure bramble can fetch schemas of downstream services, merge these and then run queries on the merged schema.