Comments (8)
i will investigate more and try to explain the root of the problem once resolved :)
from sbt-graphql.
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.
Awesome, I'm glad it works for you now! :)
from sbt-graphql.
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.
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.
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.
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.
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)
- Code generation for unions is flawed HOT 1
- codegen support for 'URI' scalar type HOT 1
- Yet another trouble getting codegen to work HOT 2
- Code generation - The output directory for generated files should be configurable. HOT 1
- Missing Sangria Custom Scalars In Schema Generation HOT 1
- Fix .scalafmt.conf
- Fragment code generation is broken for union types HOT 3
- Stable ordering of output HOT 3
- Add toString to graphqlCodegenStyle, Json HOT 2
- [question] Can I annotate generated classes? HOT 1
- Schema generation from Introspection HOT 5
- How to reorder execution of sbt-graphql plugins? HOT 9
- Code generation question HOT 5
- Examples for common use-cases HOT 5
- about graphql-Java HOT 7
- Only regenerate Scala files from GraphQL schema if schema changes HOT 1
- Move to github actions HOT 2
- Weird published version v0.1.6 HOT 2
- Question about code generation issue in test phase HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sbt-graphql.