graphql-docs 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0c591172c52100ea28d5df444164251d99b1c8a
4
- data.tar.gz: 4c9f8ae93971f7c875439b6263c5da97a89fbc55
3
+ metadata.gz: c9b413c4e5cbfbd07bf368c4af16f7aa77758f40
4
+ data.tar.gz: 5a8d0b56c9559b7b5f12dedfe52ac4fad47b29f7
5
5
  SHA512:
6
- metadata.gz: 41767ad33f35665323d890c25d1836a92a6b76ef6cc4d872904d311f629dff4650d59def428d8bd341739623b2120055fbe7eb0e71956ce90ebd3309abed8643
7
- data.tar.gz: 99ec06f96a8ba73bbc611fc1d9e48db7b3fd69681a2ad0137ee4a090016df8aeae3e47195ad68313489162f208068c904db9e42dd60a70a69142e9b3d677351c
6
+ metadata.gz: f8666f6051e0fdce5b5ea7ed21cc170bcf821716006bf459bff4e260c3a403627eed62a941f777cc34c23cc9c674d45e8257b3ec05d82fdcf0ede7e90c2ba7ba
7
+ data.tar.gz: 952b01f69dbfe4422a2e7235ef34f9235e97392866d14106dc4d5e065d4c7e3864eb20cfafaad0d4af6a55eedcb2bfa266dcf8fab918a8c528647ff2668fb032
data/README.md CHANGED
@@ -69,7 +69,7 @@ It also uses [html-pipeline](https://github.com/jch/html-pipeline) to perform th
69
69
 
70
70
  ``` ruby
71
71
  class CustomRenderer
72
- def initialize(schema, options)
72
+ def initialize(parsed_schema, options)
73
73
  @parsed_schema = parsed_schema
74
74
  @options = options
75
75
  end
@@ -36,20 +36,26 @@ module GraphQLDocs
36
36
 
37
37
  @processed_schema[:operation_types] << data
38
38
  elsif object.name == 'Mutation'
39
- data[:name] = object.name
40
- data[:description] = object.description
41
-
42
- @processed_schema[:operation_types] << data
39
+ data[:name] = object.name
40
+ data[:description] = object.description
43
41
 
44
- object.fields.each_value do |mutation|
45
- h = {}
46
- h[:name] = mutation.name
47
- h[:description] = mutation.description
48
- h[:input_fields], _ = fetch_fields(mutation.arguments.values.first.type.unwrap.input_fields)
49
- h[:return_fields], _ = fetch_fields(mutation.type.unwrap.fields)
42
+ @processed_schema[:operation_types] << data
50
43
 
51
- @processed_schema[:mutation_types] << h
44
+ object.fields.each_value do |mutation|
45
+ h = {}
46
+ h[:name] = mutation.name
47
+ h[:description] = mutation.description
48
+ h[:input_fields], _ = fetch_fields(mutation.arguments)
49
+
50
+ return_type = mutation.type
51
+ if return_type.unwrap.respond_to?(:fields)
52
+ h[:return_fields], _ = fetch_fields(return_type.unwrap.fields)
53
+ else # it is a scalar return type
54
+ h[:return_fields], _ = fetch_fields({ "#{return_type.name}" => mutation })
52
55
  end
56
+
57
+ @processed_schema[:mutation_types] << h
58
+ end
53
59
  else
54
60
  data[:name] = object.name
55
61
  data[:description] = object.description
@@ -1,3 +1,3 @@
1
1
  module GraphQLDocs
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-docs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-13 00:00:00.000000000 Z
11
+ date: 2018-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql