graphql 0.10.7 → 0.10.8

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: 6f94bf39aba9a98caa4bf69c263eacb820d41b08
4
- data.tar.gz: 4a11eb3ee5d554345942bab98098a623d33f0aad
3
+ metadata.gz: ed91d2fd1d191758d362b06dd3af5bcc53589fad
4
+ data.tar.gz: a5b9d8f9ff219f4db84e24a569a6b396d034cd87
5
5
  SHA512:
6
- metadata.gz: 33a339144c49cc616818d398248f8b6f75c507efde44975f8e03e758c7f3783887bddeadb8c094551bad3444f9c1eaa8ecf8966ef19c58fae8f6a23e95a226e0
7
- data.tar.gz: b1d227ca3c1981e22a2b8be23e30c7d7eee78f3e8a13f8b6702ea29a842d4198eb929a38b01ae19e44c39e2cef81e2b322565035d7ecf7832c80ddecc4e5aac2
6
+ metadata.gz: bb2d62a66e88dc88e52ff05cb00317b79ee05a9aa0a3a36280d2f6aab2f6d7df1205c32e327d743227f9a491ce9d7ea66283e147633482a6f0973ce27abbe125
7
+ data.tar.gz: 31400a2541cbf1673b7b83c823d5be985daab47ec68085345b248cdbcd9373f4e1b31ef94f31da14e3468a177ab36998a5b84a37e24a99b47c73c9bd7dede970
@@ -99,7 +99,7 @@ module GraphQL
99
99
  rule(:value_int) { (value_sign? >> match('\d').repeat(1)).as(:int) }
100
100
  rule(:value_string) { str('"') >> value_string_char.repeat.maybe.as(:optional_string_content).as(:string) >> str('"')}
101
101
  rule(:value_string_char) { value_string_escaped_char | value_string_escaped_unicode | value_string_source_char}
102
- rule(:value_string_escaped_char) { str("\\") >> match('["\/bfnrt]') }
102
+ rule(:value_string_escaped_char) { str("\\") >> match('["\\\\/bfnrt]') }
103
103
  rule(:value_string_escaped_unicode) { str("\\") >> match('u[\dA-Fa-f]{4}')}
104
104
  rule(:value_string_source_char) { (str('"') | str("\\") | value_string_line_terminator).absent? >> any }
105
105
  rule(:value_string_line_terminator) {
@@ -71,7 +71,7 @@ module GraphQL
71
71
  rule(alias_name: simple(:a)) { a }
72
72
  optional_sequence(:optional_field_arguments)
73
73
  rule(field_argument_name: simple(:n), field_argument_value: simple(:v)) { CREATE_NODE[:Argument, name: n.to_s, value: v, position_source: n]}
74
- rule(field_argument_name: simple(:n), field_argument_value: sequence(:v)) { CREATE_NODE[:Argument, name: n.to_s, value: v, position_source: n]}
74
+ rule(field_argument_name: simple(:n), field_argument_value: subtree(:v)) { CREATE_NODE[:Argument, name: n.to_s, value: v, position_source: n]}
75
75
  optional_sequence(:optional_selections)
76
76
  optional_sequence(:optional_directives)
77
77
 
@@ -86,7 +86,7 @@ module GraphQL
86
86
  rule(non_null_type: simple(:t)) { CREATE_NODE[:NonNullType, of_type: t, line: t.line, col: t.col] }
87
87
 
88
88
  # Values
89
- rule(array: sequence(:v)) { v }
89
+ rule(array: subtree(:v)) { v }
90
90
  rule(array: simple(:v)) { [] } # just `nil`
91
91
  rule(boolean: simple(:v)) { v == "true" ? true : false }
92
92
  rule(input_object: sequence(:v)) { CREATE_NODE[:InputObject, pairs: v, line: (v.first ? v.first.line : 1), col: (v.first ? v.first.col : 1)] }
@@ -95,13 +95,14 @@ module GraphQL
95
95
  rule(int: simple(:v)) { v.to_i }
96
96
  rule(float: simple(:v)) { v.to_f }
97
97
 
98
- ESCAPES = /\\(["\\\/bfnrt])/
98
+ ESCAPES = /\\["\\\/bfnrt]/
99
+ ESCAPES_REPLACE = { '\\"' => '"', "\\\\" => "\\", "\\/" => '/', "\\b" => "\b", "\\f" => "\f", "\\n" => "\n", "\\r" => "\r", "\\t" => "\t" }
99
100
  UTF_8 = /\\u[\da-f]{4}/i
100
101
  UTF_8_REPLACE = -> (m) { [m[-4..-1].to_i(16)].pack('U') }
101
102
 
102
103
  rule(string: simple(:v)) {
103
104
  string = v.to_s
104
- string.gsub!(ESCAPES, '\1')
105
+ string.gsub!(ESCAPES, ESCAPES_REPLACE)
105
106
  string.gsub!(UTF_8, &UTF_8_REPLACE)
106
107
  string
107
108
  }
@@ -1,3 +1,3 @@
1
1
  module GraphQL
2
- VERSION = "0.10.7"
2
+ VERSION = "0.10.8"
3
3
  end
data/readme.md CHANGED
@@ -9,9 +9,10 @@
9
9
  A Ruby implementation of [GraphQL](http://graphql.org/).
10
10
 
11
11
  - Guides
12
- - [Introduction](https://github.com/rmosolgo/graphql-ruby/blob/master/guides/introduction.md)
13
- - [Defining Your Schema](https://github.com/rmosolgo/graphql-ruby/blob/master/guides/defining_your_schema.md)
14
- - [Executing Queries](https://github.com/rmosolgo/graphql-ruby/blob/master/guides/executing_queries.md)
12
+ - [Introduction](http://www.rubydoc.info/github/rmosolgo/graphql-ruby/file/guides/introduction.md)
13
+ - [Defining Your Schema](http://www.rubydoc.info/github/rmosolgo/graphql-ruby/file/guides/defining_your_schema.md)
14
+ - [Executing Queries](http://www.rubydoc.info/github/rmosolgo/graphql-ruby/file/guides/executing_queries.md)
15
+ - [Testing](http://www.rubydoc.info/github/rmosolgo/graphql-ruby/file/guides/testing.md)
15
16
 
16
17
  - [API Documentation](http://www.rubydoc.info/github/rmosolgo/graphql-ruby)
17
18
 
@@ -92,6 +93,19 @@ If you're building a backend for [Relay](http://facebook.github.io/relay/), you'
92
93
  - A JSON dump of the schema, which you can get by sending [`GraphQL::Introspection::INTROSPECTION_QUERY`](https://github.com/rmosolgo/graphql-ruby/blob/master/lib/graphql/introspection/introspection_query.rb)
93
94
  - Relay-specific helpers for GraphQL like Connections, node fields, and global ids. Here's one example of those: [`graphql-relay`](https://github.com/rmosolgo/graphql-relay-ruby)
94
95
 
96
+ ## Getting Started Tutorials
97
+
98
+ #### Series: Building a blog in GraphQL and Relay on Rails
99
+ 1. **Introduction:** https://medium.com/@gauravtiwari/graphql-and-relay-on-rails-getting-started-955a49d251de
100
+ 2. **Part1:** https://medium.com/@gauravtiwari/graphql-and-relay-on-rails-creating-types-and-schema-b3f9b232ccfc
101
+ 3. **Part2:**
102
+ https://medium.com/@gauravtiwari/graphql-and-relay-on-rails-first-relay-powered-react-component-cb3f9ee95eca
103
+
104
+ #### Tutorials
105
+ 1. https://medium.com/@khor/relay-facebook-on-rails-8b4af2057152
106
+ 2. https://blog.jacobwgillespie.com/from-rest-to-graphql-b4e95e94c26b#.4cjtklrwt
107
+ 3. http://mgiroux.me/2015/getting-started-with-rails-graphql-relay/
108
+ 4. http://mgiroux.me/2015/uploading-files-using-relay-with-rails/
95
109
 
96
110
  ## To Do
97
111
 
@@ -119,8 +133,6 @@ If you're building a backend for [Relay](http://facebook.github.io/relay/), you'
119
133
  - This is a good chance to make an `Operation` abstraction of which `query`, `mutation` and `subscription` are members
120
134
  - For a subscription, `graphql` would send an outbound message to the system (allow the host application to manage its own subscriptions via Pusher, ActionCable, whatever)
121
135
  - Documentation
122
- - Write a "Getting started with Rails"-type blog post
123
- - Compile existing articles & slide decks and link to them from a guide
124
136
 
125
137
  ## Goals
126
138
 
@@ -24,6 +24,7 @@ describe GraphQL::Language::Transform do
24
24
  someStuff(vars: [1,2,3])
25
25
  someOtherStuff(input: {ints: [1,2,3]})
26
26
  someEmptyStuff(emptyObj: {}, emptySpaceObj: { })
27
+ evenMoreStuff(arg: [[1]])
27
28
  }
28
29
  }
29
30
 
@@ -143,4 +144,9 @@ describe GraphQL::Language::Transform do
143
144
  assert_equal(1, get_result("query { me }").parts.length)
144
145
  assert_equal(1, get_result("mutation { touch }").parts.length)
145
146
  end
147
+
148
+ it 'transforms escaped characters' do
149
+ res = get_result("{quoted: \"\\\" \\\\ \\/ \\b \\f \\n \\r \\t\"}", parse: :value_input_object)
150
+ assert_equal("\" \\ / \b \f \n \r \t", res.pairs[0].value)
151
+ end
146
152
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.7
4
+ version: 0.10.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Mosolgo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-22 00:00:00.000000000 Z
11
+ date: 2016-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parslet