Created
October 10, 2017 22:57
-
-
Save dnd/af16ed7b771cae3aabcfbac40c14c691 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Mutations::SigninUser < GraphQL::Function | |
SigninPayload = GraphQL::ObjectType.define do | |
name 'SigninPayload' | |
field :token, types.String, description: 'A JWT representing the authenticated user' | |
field :user, Types::User, description: 'The authenticated user | |
end | |
type SigninPayload | |
def call(_, args, ctx) | |
... | |
# This would be okay | |
SigninPayload.struct(token: '1234', user: user) | |
# This would fail, because :expiration is not a valid field of SigninPayload | |
SigninPayload.struct(token: '1234', expiration: '20171012') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment