object_to_graphql 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +6 -3
- data/README.md +5 -5
- data/lib/object_to_graphql/nodes.rb +1 -1
- data/lib/object_to_graphql/object_parser.rb +3 -3
- data/lib/object_to_graphql/version.rb +2 -2
- data/lib/object_to_graphql.rb +1 -1
- metadata +6 -7
- data/object_to_graphql.gemspec +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdbbfcd3931e6ed7827d508e190c1587f534f5077a79c09dc8d8d2d1a63c09d0
|
4
|
+
data.tar.gz: 4ed6776d76e95d5f1bdf3df8ed84e33f1082966f261cf71a9120b16e25fd1ebd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91cfdc1f38d60d8bf9634d043ae5d309cca3991bbaf0bb1ac05f11522ac56b68e3ba7db1349eb05f2006f4a5c8584e5b8552c77e1409761593541a9f193ca439
|
7
|
+
data.tar.gz: 61508aa5ba27c2f5d3bd7bc6d315a1e9860a315443607cdfe654bee3b33dcf4fad52213f0b3cb37b8b473a862a5b9828f938b8113b83f2cafb85df2ea4718bbe
|
data/Gemfile.lock
CHANGED
@@ -1,22 +1,23 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
object_to_graphql (0.1.
|
4
|
+
object_to_graphql (0.1.1)
|
5
5
|
activesupport
|
6
6
|
graphql
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activesupport (
|
11
|
+
activesupport (6.1.4.4)
|
12
12
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
13
|
i18n (>= 1.6, < 2)
|
14
14
|
minitest (>= 5.1)
|
15
15
|
tzinfo (~> 2.0)
|
16
|
+
zeitwerk (~> 2.3)
|
16
17
|
ast (2.4.2)
|
17
18
|
concurrent-ruby (1.1.9)
|
18
19
|
diff-lcs (1.4.4)
|
19
|
-
graphql (1.13.
|
20
|
+
graphql (1.13.3)
|
20
21
|
i18n (1.8.11)
|
21
22
|
concurrent-ruby (~> 1.0)
|
22
23
|
minitest (5.15.0)
|
@@ -61,8 +62,10 @@ GEM
|
|
61
62
|
tzinfo (2.0.4)
|
62
63
|
concurrent-ruby (~> 1.0)
|
63
64
|
unicode-display_width (2.0.0)
|
65
|
+
zeitwerk (2.5.3)
|
64
66
|
|
65
67
|
PLATFORMS
|
68
|
+
ruby
|
66
69
|
x86_64-darwin-19
|
67
70
|
x86_64-linux
|
68
71
|
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# ObjectToGraphQL
|
2
2
|
|
3
3
|
GraphQL Query generator from Ruby object structure.
|
4
4
|
|
@@ -18,7 +18,7 @@ object = {
|
|
18
18
|
],
|
19
19
|
}
|
20
20
|
}
|
21
|
-
|
21
|
+
ObjectToGraphQL.generate(object)
|
22
22
|
# => {
|
23
23
|
# user {
|
24
24
|
# name
|
@@ -50,7 +50,7 @@ arguments = [
|
|
50
50
|
[[:user, :accounts], {name: "order", value: "desc"}]
|
51
51
|
]
|
52
52
|
|
53
|
-
|
53
|
+
ObjectToGraphQL.generate(object, arguments)
|
54
54
|
# => {
|
55
55
|
# user(ID: "id-1") {
|
56
56
|
# name(separator: ",")
|
@@ -82,7 +82,7 @@ variables = [
|
|
82
82
|
{name: "$user_id", type: "ID!"}
|
83
83
|
]
|
84
84
|
|
85
|
-
|
85
|
+
ObjectToGraphQL.generate(object, arguments, variables)
|
86
86
|
# => query($user_id: ID!) {
|
87
87
|
# user(id: $user_id) {
|
88
88
|
# name
|
@@ -103,4 +103,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
103
103
|
|
104
104
|
## Code of Conduct
|
105
105
|
|
106
|
-
Everyone interacting in the
|
106
|
+
Everyone interacting in the ObjectToGraphQL project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/meganemura/object_to_graphql/blob/main/CODE_OF_CONDUCT.md).
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module ObjectToGraphQL
|
2
2
|
class ObjectParser
|
3
3
|
def self.parse(object, arguments = [], variables = [])
|
4
4
|
new(object, arguments, variables).parse
|
@@ -84,10 +84,10 @@ module ObjectToGraphql
|
|
84
84
|
not_null = str.end_with?("!")
|
85
85
|
name = str.delete_suffix("!")
|
86
86
|
|
87
|
-
type_name =
|
87
|
+
type_name = ObjectToGraphQL::Nodes::TypeName.new(name: name)
|
88
88
|
|
89
89
|
if not_null
|
90
|
-
|
90
|
+
ObjectToGraphQL::Nodes::NonNullType.new(of_type: type_name)
|
91
91
|
else
|
92
92
|
type_name
|
93
93
|
end
|
data/lib/object_to_graphql.rb
CHANGED
@@ -11,7 +11,7 @@ require_relative "object_to_graphql/object_parser"
|
|
11
11
|
require_relative "object_to_graphql/version"
|
12
12
|
require_relative "object_to_graphql/nodes"
|
13
13
|
|
14
|
-
module
|
14
|
+
module ObjectToGraphQL
|
15
15
|
def self.generate(object, arguments = [], variables = [])
|
16
16
|
document = ObjectParser.parse(object, arguments, variables)
|
17
17
|
document.to_query_string.lstrip
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: object_to_graphql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- meganemura
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -74,7 +74,6 @@ files:
|
|
74
74
|
- lib/object_to_graphql/nodes.rb
|
75
75
|
- lib/object_to_graphql/object_parser.rb
|
76
76
|
- lib/object_to_graphql/version.rb
|
77
|
-
- object_to_graphql.gemspec
|
78
77
|
homepage: https://github.com/meganemura/object_to_graphql
|
79
78
|
licenses:
|
80
79
|
- MIT
|
@@ -82,7 +81,7 @@ metadata:
|
|
82
81
|
homepage_uri: https://github.com/meganemura/object_to_graphql
|
83
82
|
source_code_uri: https://github.com/meganemura/object_to_graphql
|
84
83
|
changelog_uri: https://github.com/meganemura/object_to_graphql
|
85
|
-
post_install_message:
|
84
|
+
post_install_message:
|
86
85
|
rdoc_options: []
|
87
86
|
require_paths:
|
88
87
|
- lib
|
@@ -97,8 +96,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
96
|
- !ruby/object:Gem::Version
|
98
97
|
version: '0'
|
99
98
|
requirements: []
|
100
|
-
rubygems_version: 3.
|
101
|
-
signing_key:
|
99
|
+
rubygems_version: 3.0.3
|
100
|
+
signing_key:
|
102
101
|
specification_version: 4
|
103
102
|
summary: GraphQL Query generator from Ruby object structure
|
104
103
|
test_files: []
|
data/object_to_graphql.gemspec
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "lib/object_to_graphql/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "object_to_graphql"
|
7
|
-
spec.version = ObjectToGraphql::VERSION
|
8
|
-
spec.authors = ["meganemura"]
|
9
|
-
spec.email = ["meganemura@users.noreply.github.com"]
|
10
|
-
|
11
|
-
spec.summary = "GraphQL Query generator from Ruby object structure"
|
12
|
-
spec.description = spec.summary
|
13
|
-
spec.homepage = "https://github.com/meganemura/object_to_graphql"
|
14
|
-
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = ">= 2.4.0"
|
16
|
-
|
17
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
-
spec.metadata["source_code_uri"] = spec.homepage
|
19
|
-
spec.metadata["changelog_uri"] = spec.homepage
|
20
|
-
|
21
|
-
# Specify which files should be added to the gem when it is released.
|
22
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
24
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
25
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
26
|
-
end
|
27
|
-
end
|
28
|
-
spec.bindir = "exe"
|
29
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
|
-
spec.require_paths = ["lib"]
|
31
|
-
|
32
|
-
# Uncomment to register a new dependency of your gem
|
33
|
-
spec.add_dependency "activesupport"
|
34
|
-
spec.add_dependency "graphql"
|
35
|
-
spec.add_development_dependency "standard"
|
36
|
-
|
37
|
-
# For more information and examples about making a new gem, checkout our
|
38
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
39
|
-
end
|