graphql-libgraphqlparser 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/graphql-libgraphqlparser.gemspec +2 -0
- data/lib/graphql/libgraphqlparser/version.rb +1 -1
- data/lib/graphql/libgraphqlparser.rb +21 -2
- data/test/graphql/libgraphqlparser_test.rb +10 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04eb54d2a820c7feb3665a0248c50d4efba85183
|
4
|
+
data.tar.gz: cee6d0ba79be3ddc8a2d6876a679335520893463
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ec0914c1a78e9dfec3cfd24d2921c2ced720c2e4c69b1d9a23df36edab94a97356c50f4a00c6d73cca1a5a8e2633be8cf18fd85da42542127d50f491bc9f95e
|
7
|
+
data.tar.gz: 5f7f987b1474ef12b691544f1d8a2cf567d34171bc04058cc13d8b40ce7ca6b8ee332aa955b27ef190cfe3eaedd30ce6f446205e4af24436a1bfb68b140517d3
|
data/CHANGELOG.md
CHANGED
@@ -24,6 +24,8 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "guard-bundler", "~> 2.1"
|
25
25
|
spec.add_development_dependency "guard-minitest", "~> 2.4"
|
26
26
|
spec.add_development_dependency "guard-rake", "~> 1.0"
|
27
|
+
# Lock to a lower version to support Ruby 2.1
|
28
|
+
spec.add_development_dependency "listen", "~> 3.0.0"
|
27
29
|
spec.add_development_dependency 'minitest', '~> 5.8'
|
28
30
|
spec.add_development_dependency "minitest-reporters", "~>1.0"
|
29
31
|
spec.add_development_dependency 'rake', '~> 11.0'
|
@@ -7,8 +7,27 @@ require_relative '../graphql_libgraphqlparser_ext'
|
|
7
7
|
module GraphQL
|
8
8
|
module Libgraphqlparser
|
9
9
|
def self.parse(string)
|
10
|
-
|
11
|
-
|
10
|
+
begin
|
11
|
+
builder = builder_parse(string)
|
12
|
+
builder.document
|
13
|
+
rescue ArgumentError
|
14
|
+
if index = string.index("\x00")
|
15
|
+
string_before_null = string.slice(0, index)
|
16
|
+
line = string_before_null.count("\n") + 1
|
17
|
+
col = index - string_before_null.rindex("\n") || 0
|
18
|
+
raise GraphQL::ParseError.new("Invalid null byte in query", line, col, string)
|
19
|
+
end
|
20
|
+
raise
|
21
|
+
rescue ParseError => e
|
22
|
+
error_message = e.message.match(/(\d+)\.(\d+): (.*)/)
|
23
|
+
if error_message
|
24
|
+
line = error_message[1].to_i
|
25
|
+
col = error_message[2].to_i
|
26
|
+
raise GraphQL::ParseError.new(error_message[3], line, col, string)
|
27
|
+
else
|
28
|
+
raise GraphQL::ParseError.new(e.message, nil, nil, string)
|
29
|
+
end
|
30
|
+
end
|
12
31
|
end
|
13
32
|
end
|
14
33
|
|
@@ -237,7 +237,16 @@ describe GraphQL::Libgraphqlparser do
|
|
237
237
|
describe "errors" do
|
238
238
|
let(:query_string) {%| query doSomething { bogus { } |}
|
239
239
|
it "raises a parse error" do
|
240
|
-
err = assert_raises(GraphQL::
|
240
|
+
err = assert_raises(GraphQL::ParseError) { document }
|
241
|
+
end
|
242
|
+
|
243
|
+
it "raises a parse error in query with null byte" do
|
244
|
+
err = assert_raises(GraphQL::ParseError) do
|
245
|
+
GraphQL::Libgraphqlparser.parse("mutation{\nsend(message: \"null\x00byte\")\n}")
|
246
|
+
end
|
247
|
+
assert_equal err.message, "Invalid null byte in query"
|
248
|
+
assert_equal err.line, 2
|
249
|
+
assert_equal err.col, 20
|
241
250
|
end
|
242
251
|
end
|
243
252
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-libgraphqlparser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '1.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: listen
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 3.0.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 3.0.0
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: minitest
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
198
212
|
version: '0'
|
199
213
|
requirements: []
|
200
214
|
rubyforge_project:
|
201
|
-
rubygems_version: 2.
|
215
|
+
rubygems_version: 2.2.0
|
202
216
|
signing_key:
|
203
217
|
specification_version: 4
|
204
218
|
summary: Use Libgraphqlparser to parse queries for the GraphQL gem
|