GithubHelp home page GithubHelp logo

Comments (4)

dali546 avatar dali546 commented on May 9, 2024

Workaround:

I did bypass this by modifying lighthouse-graphql-passport.php config:
'schema' => config('lighthouse.schema.register'),

This will then use the lighthouse default schema.

There was one issue though. If the default schema in lighthouse.php is auth.graphql I get the following error

   GraphQL\Error\InvariantViolation  : The root Query type must be present in the schema.

  at /mnt/data/DATA/Community/Community-Server/vendor/nuwave/lighthouse/src/Schema/SchemaBuilder.php:82
    78|             }
    79|         }
    80| 
    81|         if (empty($queryType)) {
  > 82|             throw new InvariantViolation(
    83|                 'The root Query type must be present in the schema.'
    84|             );
    85|         }
    86| 

  Exception trace:

  1   Nuwave\Lighthouse\Schema\SchemaBuilder::build(Object(Nuwave\Lighthouse\Schema\AST\DocumentAST))
      /mnt/data/DATA/Community/Community-Server/vendor/nuwave/lighthouse/src/GraphQL.php:242

The workaround to that was to use my normal schema.graphql and import auth.graphql to it.

from lighthouse-graphql-passport-auth.

joselfonseca avatar joselfonseca commented on May 9, 2024

Hello the and thanks for the question.

So you can define your own schema by setting the file path in your config, when you publish the package config also the default schema is published so you can set the type to what ever you need. This is demonstrated in this article

https://ditecnologia.com/2019/06/24/graphql-auth-with-passport-and-lighthouse-php/

The reason for the schema to be registered and use all those defaults is for convenience, but it is also fully customizable as you can see in the article.

Let me know if that answer your question to close this issue or if you need more guidance in your specific use case.

Thanks!

from lighthouse-graphql-passport-auth.

dali546 avatar dali546 commented on May 9, 2024

Yes it is ok to close. The issue I was facing is that I went ahead and created my own schema, but failed to update the config.

My assumption was that if i published the schema and config, the config should automatically use my schema. I see now after re reading the readme it does say the config should be updated. good to close

from lighthouse-graphql-passport-auth.

mustafa-kahraman avatar mustafa-kahraman commented on May 9, 2024

If you don't have Mutation type at your master schema file... you can NOT extend your schema with Auth schema cuz it has extend type Mutation type which there is nothing to extend...

from lighthouse-graphql-passport-auth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.