GithubHelp home page GithubHelp logo

Comments (8)

s3ni0r avatar s3ni0r commented on May 31, 2024 1

i will investigate more and try to explain the root of the problem once resolved :)

from sbt-graphql.

s3ni0r avatar s3ni0r commented on May 31, 2024 1

So yeah , for whatever reason my root project was pulling sangria version 2.0.0-M3 and the submodule was pulling version 1.4.0, i have run show evicted to detect that and used a temporary dependencyOverrides to force sangria version to 1.4.0 to test if your suggestion works.

dependencyOverrides ++= Seq(
      "org.sangria-graphql"         %% "sangria"                  % "1.4.0",
    )

Now it works perfectly 👍, Thank you! @felixbr for your time and help :).

from sbt-graphql.

felixbr avatar felixbr commented on May 31, 2024 1

Awesome, I'm glad it works for you now! :)

from sbt-graphql.

felixbr avatar felixbr commented on May 31, 2024

Yes, in general it is possible. The graphqlSchemas key is a list of schemas. They are referred to via the label you give them.

See: https://github.com/muuki88/sbt-graphql#schema-definitions

edit: I might have misunderstood what you're trying to do. If you're talking about the schema generation from your sangria code, you can probably either use two sub-modules with different graphqlSchemaSnippet settings or (if that isn't possible for you), you'll have to dynamically redefine the setting. The latter is quite hacky, so I'd recommend to use sub-modules instead.

from sbt-graphql.

s3ni0r avatar s3ni0r commented on May 31, 2024

Yes, i was talking about schema generation, the sub-modules solution was considered, but it's too expensive to implement.
thank you for your answer and guidelines :)!

from sbt-graphql.

felixbr avatar felixbr commented on May 31, 2024
lazy val privateSchemaGen = (project in file("privateSchemaGen"))
  .enablePlugins(GraphQLSchemaPlugin)
  .settings(
    graphqlSchemaSnippet := "my.project.schema.PrivateSchema"
  )
  .dependsOn(main) // or whatever the module with your schema is called

I haven't tested this, but something like this could do the trick even without moving code around and you can call it via privateSchemaGen/graphqlSchemaGen.

from sbt-graphql.

s3ni0r avatar s3ni0r commented on May 31, 2024

I spent some time trying to implement your suggestion, but i end up each time with a weird error.

sbt:some-api> privateSchemaGen/graphqlSchemaGen
[info] running graphql.SchemaGen xxx/privateSchemaGen/target/sbt-graphql/schema.graphql
[error] (run-main-0) java.lang.NoSuchMethodError: sangria/schema/PossibleInterface$.convert(Lsangria/schema/InterfaceType;Lsangria/schema/PossibleType;)Lsangria/schema/PossibleInterface; (loaded from file:xxx/.coursier/cache/v1/https/repo1.maven.org/maven2/org/sangria-graphql/sangria_2.12/1.4.2/sangria_2.12-1.4.2.jar by URLClassLoader with NativeCopyLoader with RawResources(

the convert function doesn't exist since version 1.3.x, and we are using sangria version 1.4.2 with plugin version 0.14.0.

Also when i try to generate a single schema on the root project without any submodules, it works with the same library and plugin versions.

from sbt-graphql.

felixbr avatar felixbr commented on May 31, 2024

That's a shame. I don't have time to dig into this right now, sadly. The only thing I can think of is that your submodule is missing the sangria dependency somehow?

In any case we should probably look into this as having more than one schema is not really a rare thing. At our company we have multiple schemas as well but they are all subsets of a "master" schema, which is the only one we generate the schema-file for (the file is only used for code-review, so it's not too important).

from sbt-graphql.

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.