graphql_helper_generator 0.0.22 → 0.0.23
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6758e072fcd1b532ce10f65e316b7ed6a1882c8e2e361425ad8c110d831ee6f6
|
4
|
+
data.tar.gz: 2cd08eab5a903105711a137469ddb8e53f8ab29f55bf70ce6da5ae1039346877
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ba7e71f8e439f7e15e415edb81f1afdc91d1e0207f258d16ddfc647df1e238137196a1c0cd18c0e4fe2d3fc872f280184761b649d7eeb67be4a868010f32c20
|
7
|
+
data.tar.gz: 833868b6e3dfe3c176b9ef76eaeac5919c1f56ae2ec1e39b9eb2f928a99182d77d452ff14ef5fef7c42a2b2d4bce7ed852fa5ae202279c1d271578c0ff1d8758
|
@@ -162,11 +162,14 @@ class GraphqlModelGenerator < Rails::Generators::NamedBase
|
|
162
162
|
|
163
163
|
def generate_create_test_lines
|
164
164
|
@create_test_define_line =
|
165
|
-
@parsed_fields.
|
165
|
+
@parsed_fields.map{|field|
|
166
166
|
name = field[:name].camelize
|
167
167
|
name[0] = name[0].downcase
|
168
|
-
|
169
|
-
|
168
|
+
if field[:type] == 'references' then name += 'Id'
|
169
|
+
str = "$" + name + ": "
|
170
|
+
type = cast_to_graphql_input(field)
|
171
|
+
if field[:array].present? then type = '[' + type + ']' end
|
172
|
+
str += type
|
170
173
|
if field[:required].present? then str += "!" end
|
171
174
|
str
|
172
175
|
}.join(', ')
|
@@ -228,14 +231,7 @@ class GraphqlModelGenerator < Rails::Generators::NamedBase
|
|
228
231
|
def generate_type_fields
|
229
232
|
@type_fields =
|
230
233
|
@parsed_fields.map{|field|
|
231
|
-
str = 'field :'
|
232
|
-
if field[:reference].present?
|
233
|
-
str += field[:name].underscore + "s"
|
234
|
-
else
|
235
|
-
str += field[:name].underscore
|
236
|
-
end
|
237
|
-
|
238
|
-
str += ", "
|
234
|
+
str = 'field :' + field[:name].underscore + ', '
|
239
235
|
|
240
236
|
type = cast_to_graphql(field)
|
241
237
|
if field[:reference].present? || field[:type] == 'references' then type = field[:name].camelize + "Type" end
|
@@ -314,6 +310,7 @@ class GraphqlModelGenerator < Rails::Generators::NamedBase
|
|
314
310
|
elsif type == 'Json' then type = 'JSON'
|
315
311
|
elsif type == 'Boolean' then type = 'Boolean'
|
316
312
|
elsif type == 'Integer' then type = 'Int'
|
313
|
+
elsif type == 'References' then type = 'ID'
|
317
314
|
end
|
318
315
|
type
|
319
316
|
end
|