Skip to content

Commit ec9da06

Browse files
committed
use GraphQL::Types::ID instead of Int type in generated crud mutations
1 parent 79537c9 commit ec9da06

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ $ rails generate gql:model_type MODEL_CLASS
3131

3232
#### Options
3333

34-
* `--name` - customize the file/class name, useful if you don't want the default Type suffix.
34+
- `--name` - customize the file/class name, useful if you don't want the default Type suffix.
3535

3636
#### Example
3737

3838
```ruby
3939
# app/graphql/post_type.rb
4040
module Types
4141
class PostType < Types::BaseObject
42-
field :id, Int, null: true
42+
field :id, GraphQL::Types::ID, null: true
4343
field :title, String, null: true
4444
field :body, String, null: true
4545
field :created_at, GraphQL::Types::ISO8601DateTime, null: true
@@ -58,7 +58,7 @@ rails generate gql:input Post
5858

5959
#### Options
6060

61-
* `--name` - customize the file/class name, useful if you don't want the default Input suffix.
61+
- `--name` - customize the file/class name, useful if you don't want the default Input suffix.
6262

6363
#### Example
6464

@@ -117,7 +117,7 @@ module Mutations
117117
field :post, Types::PostType, null: true
118118

119119
argument :attributes, Types::Input::PostInput, required: true
120-
argument :id, Int, required: false
120+
argument :id, GraphQL::Types::ID, required: false
121121

122122
def resolve(attributes:, id: nil)
123123
model = find_or_build_model(id)

lib/generators/gql/templates/delete_mutation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Mutations
22
class <%= prefixed_class_name('Delete') %> < Mutations::BaseMutation
33
field :<%= singular_name %>, Types::<%= name %>Type, null: true
44
5-
argument :id, Int, required: true
5+
argument :id, GraphQL::Types::ID, required: true
66
77
def resolve(id:)
88
model = <%= class_name %>.find(id)

lib/generators/gql/templates/model_mutation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class <%= prefixed_class_name(mutation_prefix) %> < Mutations::BaseMutation
33
field :<%= singular_name %>, Types::<%= @model_name %>Type, null: true
44
55
argument :attributes, Types::Input::<%= @model_name %>Input, required: true
6-
argument :id, Int, required: false
6+
argument :id, GraphQL::Types::ID, required: false
77

88
def resolve(attributes:, id: nil)
99
model = find_or_build_model(id)

lib/generators/gql/templates/update_mutation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Mutations
22
class <%= prefixed_class_name('Update') %> < Mutations::BaseMutation
33
field :<%= singular_name %>, Types::<%= name %>Type, null: true
44
5-
argument :id, Int, required: true
5+
argument :id, GraphQL::Types::ID, required: true
66
argument :attributes, Types::Input::<%= name %>Input, required: true
77

88
def resolve(attributes:, id:)

0 commit comments

Comments
 (0)