Skip to content

Commit b7e76f7

Browse files
committed
favor system typename hint.
1 parent 384c83c commit b7e76f7

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ Testing GraphQL queries using fixture responses runs the risk of false-positive
66
gem "graphql-response_validator"
77
```
88

9+
Then:
10+
11+
```shell
12+
require "graphql/response_validator"
13+
```
14+
915
## Usage
1016

1117
Build a test query and its response data into a `GraphQL::ResponseValidator`, then assert that the fixture is correct for the query as part of your test:

lib/graphql/response_validator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def validate_leaf(parent_type, value, path)
153153
def resolved_type(parent_type, data_part, path)
154154
return parent_type unless parent_type.kind.abstract?
155155

156-
typename = data_part["__typename"] || data_part[@system_typename]
156+
typename = data_part[@system_typename] || data_part["__typename"]
157157
if typename.nil?
158158
@errors << ValidationError.new("Abstract position expects `__typename` or system typename hint", path.dup)
159159
return nil

lib/graphql/response_validator/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
module GraphQL
44
class ResponseValidator
5-
VERSION = "0.0.1"
5+
VERSION = "0.0.2"
66
end
77
end

0 commit comments

Comments
 (0)