graphql-devise / graphql_devise

GraphQL interface on top devise_token_auth
MIT License
200 stars 39 forks source link

Mount only necessary operations in existing schema. #239

Closed mateuszbialowas closed 2 years ago

mateuszbialowas commented 2 years ago

Question

  use GraphqlDevise::SchemaPlugin.new(
    query: Types::QueryType,
    mutation: Types::MutationType,
    resource_loaders: [
      GraphqlDevise::ResourceLoader.new(Clinic, { skip: %i[update_password_with_token
                                                           send_password_reset_with_token
                                                           resend_confirmation_with_token
                                                           confirm_registration_with_token] })
    ],
    authenticate_default: false
  )

In docs I found only options to skip load resources for listed operations. Can I prevent mounting send_password_reset_with_token at all? I don't want the mutation send_password_reset_with_token to be available in my mutations. Can I do this?

mcelicalderon commented 2 years ago

Hey, @mateuszbialowas! You sure can. Take a look at the available options you can pass to the resource mounter in https://github.com/graphql-devise/graphql_devise#available-mount-options

You can specify the only or skip option to get only the mutations you want. Let me know if that worked

mcelicalderon commented 2 years ago

I see in your example that you are actually using skip. Is that not working? Could you provide a sample repository where you can observe this behavior?

mateuszbialowas commented 2 years ago

@mcelicalderon When you said that everything should be fine, I restarted my computer and it began working. Thank you very much.