graphql_grpc 0.1.2 → 0.1.3

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
  SHA256:
3
- metadata.gz: 06d989878ec186d18927efeceed776b0a295a56397d45b35429a236e1bb1b5de
4
- data.tar.gz: 335e7bbc7570f5e984f04c3cf580ba36e1aeda004109d2ec2d0ae652821f3db9
3
+ metadata.gz: 41e7582c666ad86741095980d91c3b44296e29741b071e45824f7f82ec9fa940
4
+ data.tar.gz: bd4862634e087c8ddbd1de4796522ec67c428dcbafdb337ca05b5e8c9d5993e4
5
5
  SHA512:
6
- metadata.gz: 5b6bef286f6df1c4515ed7079c172746b355164bdb1c59aada4b432171c9f165a17c831abc408ed520a4c41bea13cb602d3fb722d8785d89c84309284297c43b
7
- data.tar.gz: 07fb3f97a773bab2271f342a4c45e49648d97164e010b937a1a346d4a664b2f6bafa5203ad4f5c9484d3208758ef5fb85d1e8fc8f84d844d0ed5016f8c6b68de
6
+ metadata.gz: 87d749fe01254f438de4a6978e84fe44c1dc8399a6676f84f31eee5028a4b6ba6fe5dd9510e8d0ee11be218f9065ef5d1654bfa734326bb61ad2c62cc8b6b5ac
7
+ data.tar.gz: 608b5f6903c15e9b28c3542a5595fcd104c3e3fb88ae4817999aa025881e64a4f4a1001e45faa24fe23cf7bf475784b70b8dc4052fc09fc672f779a093ea4da1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- graphql_grpc (0.1.2)
4
+ graphql_grpc (0.1.3)
5
5
  activesupport
6
6
  graphql
7
7
  grpc
@@ -17,19 +17,31 @@ GEM
17
17
  addressable (2.5.2)
18
18
  public_suffix (>= 2.0.2, < 4.0)
19
19
  ast (2.4.0)
20
+ atlas-rb (1.0.11)
21
+ faraday
20
22
  bombshell (0.1.6)
21
23
  coderay (1.1.2)
22
- concurrent-ruby (1.1.2)
24
+ concurrent-ruby (1.1.3)
23
25
  diff-lcs (1.3)
26
+ faraday (0.15.3)
27
+ multipart-post (>= 1.2, < 3)
24
28
  ffi (1.9.25)
25
29
  formatador (0.2.5)
26
30
  google-protobuf (3.6.1)
27
31
  googleapis-common-protos-types (1.0.2)
28
32
  google-protobuf (~> 3.0)
33
+ googleauth (0.6.7)
34
+ faraday (~> 0.12)
35
+ jwt (>= 1.4, < 3.0)
36
+ memoist (~> 0.16)
37
+ multi_json (~> 1.11)
38
+ os (>= 0.9, < 2.0)
39
+ signet (~> 0.7)
29
40
  graphql (1.8.11)
30
- grpc (1.16.0-universal-darwin)
41
+ grpc (1.12.0)
31
42
  google-protobuf (~> 3.1)
32
43
  googleapis-common-protos-types (~> 1.0.0)
44
+ googleauth (>= 0.5.1, < 0.7)
33
45
  guard (2.14.2)
34
46
  formatador (>= 0.2.4)
35
47
  listen (>= 2.7, < 4.0)
@@ -50,37 +62,51 @@ GEM
50
62
  rspec (>= 2.99.0, < 4.0)
51
63
  i18n (1.1.1)
52
64
  concurrent-ruby (~> 1.0)
53
- jaro_winkler (1.5.1-x86_64-darwin-17)
65
+ jaro_winkler (1.5.1)
54
66
  json-schema (2.8.1)
55
67
  addressable (>= 2.4)
68
+ jwt (2.1.0)
56
69
  listen (3.1.5)
57
70
  rb-fsevent (~> 0.9, >= 0.9.4)
58
71
  rb-inotify (~> 0.9, >= 0.9.7)
59
72
  ruby_dep (~> 1.2)
60
73
  lumberjack (1.0.13)
61
- method_source (0.9.0)
62
- mime-types (2.6.2)
74
+ memoist (0.16.0)
75
+ metatron (0.1.1)
76
+ method_source (0.9.1)
63
77
  minitest (5.11.3)
78
+ multi_json (1.13.1)
79
+ multipart-post (2.0.0)
80
+ mustermann (1.0.3)
64
81
  nenv (0.3.0)
82
+ nf-configuration (1.4.2)
83
+ grpc (~> 1.12.0)
84
+ rspec (~> 3.2)
85
+ nf-discovery (0.2.0)
86
+ grpc (= 1.12)
87
+ rspec (~> 3.2)
65
88
  notiffany (0.1.1)
66
89
  nenv (~> 0.1)
67
90
  shellany (~> 0.0)
91
+ os (1.0.0)
68
92
  parallel (1.12.1)
69
93
  parser (2.5.3.0)
70
94
  ast (~> 2.4.0)
71
95
  powerpack (0.1.2)
72
- pry (0.11.3)
96
+ pry (0.12.0)
73
97
  coderay (~> 1.1.0)
74
98
  method_source (~> 0.9.0)
75
99
  public_suffix (3.0.3)
76
- rack (1.6.11)
77
- rack-protection (1.5.5)
100
+ rack (2.0.6)
101
+ rack-protection (2.0.4)
78
102
  rack
79
103
  rainbow (3.0.0)
80
104
  rake (10.5.0)
81
105
  rb-fsevent (0.10.3)
82
106
  rb-inotify (0.9.10)
83
107
  ffi (>= 0.5.0, < 2)
108
+ redis (4.0.3)
109
+ retries (0.0.5)
84
110
  rspec (3.8.0)
85
111
  rspec-core (~> 3.8.0)
86
112
  rspec-expectations (~> 3.8.0)
@@ -104,22 +130,32 @@ GEM
104
130
  unicode-display_width (~> 1.4.0)
105
131
  ruby-progressbar (1.10.0)
106
132
  ruby_dep (1.5.0)
107
- ruby_robot (0.1.9)
133
+ ruby_robot (0.1.10)
108
134
  bombshell
109
135
  bundler (~> 1.16)
110
136
  grpc
111
137
  json-schema
112
- sinatra (< 2)
113
- sinatra-swagger-exposer
138
+ sinatra (~> 2.0)
114
139
  wirble
140
+ sdp-search (0.5.6.pre.rc.27)
141
+ atlas-rb (~> 1.0, >= 1.0.8)
142
+ grpc (~> 1.12, >= 1.12.0)
143
+ metatron (~> 0.1, >= 0.1.1)
144
+ nf-configuration (~> 1)
145
+ nf-discovery (~> 0)
146
+ redis
147
+ retries (~> 0.0.5)
115
148
  shellany (0.0.1)
116
- sinatra (1.4.8)
117
- rack (~> 1.5)
118
- rack-protection (~> 1.4)
119
- tilt (>= 1.3, < 3)
120
- sinatra-swagger-exposer (0.4.0)
121
- mime-types (~> 2.6.2)
122
- sinatra (~> 1.4)
149
+ signet (0.11.0)
150
+ addressable (~> 2.3)
151
+ faraday (~> 0.9)
152
+ jwt (>= 1.5, < 3.0)
153
+ multi_json (~> 1.10)
154
+ sinatra (2.0.4)
155
+ mustermann (~> 1.0)
156
+ rack (~> 2.0)
157
+ rack-protection (= 2.0.4)
158
+ tilt (~> 2.0)
123
159
  thor (0.20.0)
124
160
  thread_safe (0.3.6)
125
161
  tilt (2.0.8)
@@ -140,6 +176,7 @@ DEPENDENCIES
140
176
  rake (~> 10.0)
141
177
  rubocop
142
178
  ruby_robot
179
+ sdp-search
143
180
  wirble
144
181
 
145
182
  BUNDLED WITH
@@ -20,23 +20,23 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
+ require 'google/protobuf/empty_pb'
24
+
23
25
  module GraphqlGrpc
24
26
  module Schema
27
+ # TODO: Find better way to detect queries
28
+ # Currently look for methods named 'get' or with no args
29
+ def query?(name_sym, rpc_desc)
30
+ name_sym.to_s.start_with?('get') ||
31
+ rpc_desc.rpc_desc.input == Google::Protobuf::Empty
32
+ end
33
+
25
34
  def gql_mutations
26
- # TODO: Find better way to detect mutations
27
- @function_map.reject do |name_sym, _rpc_des|
28
- name_sym.to_s.start_with?('get') ||
29
- _rpc_des.rpc_desc.input == Google::Protobuf::Empty
30
- end
35
+ @function_map.reject { |name_sym, rpc_desc| query?(name_sym, rpc_desc) }
31
36
  end
32
37
 
33
38
  def gql_queries
34
- # TODO: Find better way to detect queries
35
- # Currently look for methods named 'get' or with no args
36
- @function_map.select do |name_sym, _rpc_des|
37
- name_sym.to_s.start_with?('get') ||
38
- _rpc_des.rpc_desc.input == Google::Protobuf::Empty
39
- end
39
+ @function_map.select { |name_sym, rpc_desc| query?(name_sym, rpc_desc) }
40
40
  end
41
41
 
42
42
  def to_schema_types
@@ -56,17 +56,23 @@ module GraphqlGrpc
56
56
  end
57
57
 
58
58
  def to_schema_query
59
- "type Query {
60
- #{to_function_types(gql_queries)}
61
- }"
59
+ return 'type Query {'\
60
+ ' # """This gRPC stub does not contain any methods that are mapped to '\
61
+ 'GraphQL queries; this placeholder query field keeps the Query type from '\
62
+ 'being empty which can break tools (GraphiQL) which expect Query to contain '\
63
+ 'at least one field."""'\
64
+ '
65
+ '\
66
+ ' grpcPlacholder: Url'\
67
+ '}' if gql_queries.empty?
68
+
69
+ "type Query { #{to_function_types(gql_queries)} }"
62
70
  end
63
71
 
64
72
  def to_schema_mutations
65
73
  return '' if gql_mutations.empty?
66
74
 
67
- "type Mutation {
68
- #{to_function_types(gql_mutations)}
69
- }"
75
+ "type Mutation { #{to_function_types(gql_mutations)} }"
70
76
  end
71
77
 
72
78
  def to_gql_schema
@@ -230,7 +230,15 @@ module GraphqlGrpc
230
230
  # as the argument for a gRPC call that is being mapped to a
231
231
  # GraphQL query.
232
232
  @descriptors.delete_if do |key, descriptor|
233
- descriptor.respond_to?(:sub_types) and descriptor.sub_types.empty?
233
+
234
+ if (descriptor.name.start_with?('google.protobuf') &&
235
+ descriptor.respond_to?(:sub_types) &&
236
+ descriptor.sub_types.empty?
237
+ )
238
+ true
239
+ else
240
+ false
241
+ end
234
242
  end
235
243
  end
236
244
  end
@@ -1,3 +1,3 @@
1
1
  module GraphqlGrpc
2
- VERSION = '0.1.2'.freeze
2
+ VERSION = '0.1.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql_grpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zane Claes
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-11-06 00:00:00.000000000 Z
12
+ date: 2018-11-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport