graphql-rails-api 0.8.0 → 0.9.0
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 +4 -4
- data/README.md +1 -3
- data/lib/generators/graphql_add_fields/graphql_add_fields_generator.rb +3 -3
- data/lib/generators/graphql_all_connections/graphql_all_connections_generator.rb +1 -0
- data/lib/generators/graphql_mutations/graphql_mutations_generator.rb +1 -1
- data/lib/generators/graphql_rails_api/install_generator.rb +4 -2
- data/lib/generators/graphql_resource/graphql_resource_generator.rb +10 -6
- data/lib/graphql/rails/api/version.rb +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c789b39c99efe639f6a7d035d012d28b4d6cff882c4bcfb7c1145ec03ffa7d9
|
4
|
+
data.tar.gz: 27c85cd1193f34216fe52d9dde5f05e0a5ca87bec25efb24ffc9a72c0be447c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c73593751c6aff011ae081788c1072fbeca7a8b86c0dd736c00c635f4956db56a178dfe3518a6c39a5a7c286cb939675fc67862cfa36b09617a396998e086a9
|
7
|
+
data.tar.gz: '069beded1ed21d5c0392e4daf48ceae733a6e95f8f022eb5341fd0541e89a5849a8acd3db0f8b59355c08d9ec3479f4860ddb96071fdd95acdd66bc2b8bd110a'
|
data/README.md
CHANGED
@@ -2,8 +2,7 @@
|
|
2
2
|
|
3
3
|
`graphql-rails-api` is a gem that provides generators to describe easily your graphql API in a domain driven design way.
|
4
4
|
|
5
|
-
Need any help or wanna talk with me about it on
|
6
|
-
https://bit.ly/2KvV8Pk
|
5
|
+
Need any help or wanna talk with me about it on discord : Poilon#5412
|
7
6
|
|
8
7
|
## Installation
|
9
8
|
|
@@ -17,7 +16,6 @@ rails db:create
|
|
17
16
|
|
18
17
|
Add these lines to your application's Gemfile:
|
19
18
|
```ruby
|
20
|
-
gem 'graphql'
|
21
19
|
gem 'graphql-rails-api'
|
22
20
|
```
|
23
21
|
|
@@ -245,10 +245,10 @@ t.#{@id_db_type} :#{resource.underscore.singularize}_id
|
|
245
245
|
file_name = "app/models/#{model.underscore.singularize}.rb"
|
246
246
|
return if !File.exist?(file_name) || File.read(file_name).include?(line)
|
247
247
|
|
248
|
-
|
249
|
-
|
248
|
+
file = open(file_name)
|
249
|
+
line_count = file.readlines.size
|
250
250
|
line_nb = 0
|
251
|
-
|
251
|
+
file.each do |l|
|
252
252
|
line_nb += 1
|
253
253
|
break if l.include?('ApplicationRecord')
|
254
254
|
end
|
@@ -3,7 +3,7 @@ class GraphqlMutationsGenerator < Rails::Generators::NamedBase
|
|
3
3
|
def generate
|
4
4
|
resource = file_name.underscore.singularize
|
5
5
|
dir = "app/graphql/#{resource.pluralize}/mutations"
|
6
|
-
|
6
|
+
FileUtils.mkdir_p(dir) unless File.directory?(dir)
|
7
7
|
generate_create_mutation(dir, resource)
|
8
8
|
generate_update_mutation(dir, resource)
|
9
9
|
generate_destroy_mutation(dir, resource)
|
@@ -8,8 +8,10 @@ module GraphqlRailsApi
|
|
8
8
|
|
9
9
|
def generate_files
|
10
10
|
@app_name = File.basename(Rails.root.to_s).underscore
|
11
|
-
|
12
|
-
|
11
|
+
|
12
|
+
folder = 'app/graphql/'
|
13
|
+
FileUtils.mkdir_p(folder) unless File.directory?(folder)
|
14
|
+
|
13
15
|
write_uuid_extensions_migration
|
14
16
|
|
15
17
|
write_service
|
@@ -103,7 +103,7 @@ class GraphqlResourceGenerator < Rails::Generators::NamedBase
|
|
103
103
|
end
|
104
104
|
|
105
105
|
def generate_basic_mutations(resource)
|
106
|
-
|
106
|
+
FileUtils.mkdir_p(@mutations_directory) unless File.directory?(@mutations_directory)
|
107
107
|
system("rails generate graphql_mutations #{resource}")
|
108
108
|
|
109
109
|
# Graphql Input Type
|
@@ -126,7 +126,8 @@ class GraphqlResourceGenerator < Rails::Generators::NamedBase
|
|
126
126
|
end
|
127
127
|
|
128
128
|
def generate_graphql_input_type(resource)
|
129
|
-
|
129
|
+
FileUtils.mkdir_p(@mutations_directory) unless File.directory?(@mutations_directory)
|
130
|
+
|
130
131
|
File.write(
|
131
132
|
"#{@mutations_directory}/input_type.rb",
|
132
133
|
<<~STRING
|
@@ -241,6 +242,9 @@ class GraphqlResourceGenerator < Rails::Generators::NamedBase
|
|
241
242
|
end
|
242
243
|
|
243
244
|
def generate_service(resource)
|
245
|
+
|
246
|
+
FileUtils.mkdir_p("app/graphql/#{resource.pluralize}/") unless File.directory?("app/graphql/#{resource.pluralize}/")
|
247
|
+
|
244
248
|
File.write(
|
245
249
|
"app/graphql/#{resource.pluralize}/service.rb",
|
246
250
|
<<~STRING
|
@@ -308,13 +312,13 @@ t.#{@id_db_type} :#{resource.underscore.singularize}_id
|
|
308
312
|
end
|
309
313
|
|
310
314
|
def add_to_model(model, line)
|
311
|
-
file_name = "app
|
315
|
+
file_name = File.join("app","models","#{model.underscore.singularize}.rb")
|
312
316
|
return if !File.exist?(file_name) || File.read(file_name).include?(line)
|
313
317
|
|
314
|
-
|
315
|
-
|
318
|
+
file = open(file_name)
|
319
|
+
line_count = file.readlines.size
|
316
320
|
line_nb = 0
|
317
|
-
|
321
|
+
file.each do |l|
|
318
322
|
line_nb += 1
|
319
323
|
break if l.include?('ApplicationRecord')
|
320
324
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-rails-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- poilon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|
@@ -42,22 +42,22 @@ dependencies:
|
|
42
42
|
name: rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 6.0.0
|
48
45
|
- - "~>"
|
49
46
|
- !ruby/object:Gem::Version
|
50
|
-
version:
|
47
|
+
version: 7.0.0
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 6.1.4
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
|
-
- - ">="
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: 6.0.0
|
58
55
|
- - "~>"
|
59
56
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
57
|
+
version: 7.0.0
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 6.1.4
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rkelly-remix
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
114
|
- !ruby/object:Gem::Version
|
115
115
|
version: '0'
|
116
116
|
requirements: []
|
117
|
-
rubygems_version: 3.
|
117
|
+
rubygems_version: 3.1.2
|
118
118
|
signing_key:
|
119
119
|
specification_version: 4
|
120
120
|
summary: Graphql rails api framework to create easily graphql api with rails
|