@@ -62,21 +62,23 @@ Input objects are passed to field methods as an instance of their definition cla
62
62
- calling ` #[] ` with the _ camel-cased_ name of the argument (this is for compatibility with previous GraphQL-Ruby versions)
63
63
64
64
``` ruby
65
- # This field takes an argument called `attributes`
66
- # which will be an instance of `PostAttributes`
67
- field :create_post , Types ::Post , null: false do
68
- argument :attributes , Types ::PostAttributes
69
- end
65
+ class Types ::MutationType < GraphQL ::Schema ::Object
66
+ # This field takes an argument called `attributes`
67
+ # which will be an instance of `PostAttributes`
68
+ field :create_post , Types ::Post , null: false do
69
+ argument :attributes , Types ::PostAttributes
70
+ end
70
71
71
- def create_post (attributes: )
72
- puts attributes.class .name
73
- # => "Types::PostAttributes"
74
- # Access a value by method (underscore-cased):
75
- puts attributes.full_text
76
- # => "This is my first post"
77
- # Or by hash-style lookup (camel-cased, for compatibility):
78
- puts attributes[:fullText ]
79
- # => "This is my first post"
72
+ def create_post (attributes: )
73
+ puts attributes.class .name
74
+ # => "Types::PostAttributes"
75
+ # Access a value by method (underscore-cased):
76
+ puts attributes.full_text
77
+ # => "This is my first post"
78
+ # Or by hash-style lookup (camel-cased, for compatibility):
79
+ puts attributes[:fullText ]
80
+ # => "This is my first post"
81
+ end
80
82
end
81
83
```
82
84
0 commit comments