Comments (12)
Unfortunately not after doing a quick pass over the weekend. I won't be able to look into things in too much depth for a couple days, but my guess is that the issue is a config typo on my end. I'm planning on building up a sample project from scratch when I can circle back to this project to isolate the problem. If you want to close this out for now, I can reach out / reopen it if I still have trouble when I take a more in depth stab at it later in the week.
from sbt-graphql.
Thanks for the lengthy post 🤗🤩 context is the best for figuring out what's wrong.
From a high level perspective everything looks good ( really clean build.sbt
👍 ). Can you try what happens if you comment out
graphqlCodegenStyle := Sangria
I really chose a very confusing name. The Apollo style has nothing to do with the implementation, but how things looks. We recommend this default style.
You can also try to build up your build.sbt from the test-project or a scripted test from the repo.
At this point I'm not sure if this is a bug or a misconfiguration 🤔
from sbt-graphql.
Thanks for the quick response!
I tried commenting out the line you suggested, but still have the same results :/ . I'll try building up the build.sbt from the test project like you suggested and see if I can isolate the problem. If that doesn't work, can I send you over a zip of my project? Of course no worries if you're pressed on time, but I figured it might be more efficient than trading comments since I'm pretty unfamiliar with this stuff. Thanks again!
from sbt-graphql.
Awesome 😎
Yeah, you can create a public git repo and I'll check that out and see if I find anything suspicious. Won't be able to do that today unfortunately 😬
from sbt-graphql.
@hwang123 did you have any luck finding out the issue?
from sbt-graphql.
Sounds reasonable 👍
from sbt-graphql.
I have a similar problem. I created a minimal project just following the docs and when running sbt graphqlCodegen
I have the expected starwars.graphql
file in target/graphql
directory but only this generated scala code in target/scala-2.12/src_managed/sbt-graphql/GraphQLCodegen.scala
:
package graphql.codegen
object GraphQLCodegen
Here's the sbt logs :
[info] Rendering schema to: /Users/marckarassev/Desktop/bd4m/graphqlCodegen-test/target/graphql/starwars.graphql
[info] Introspect graphql endpoint: http://try.sangria-graphql.org/graphql
[info] Generate code for 0 queries
[info] Use schema /Users/marckarassev/Desktop/bd4m/graphqlCodegen-test/target/graphql/starwars.graphql for query validation
[info] Generating json decoding with: None$
from sbt-graphql.
Your test project doesn't contain any graphql files. The log output mentions this :
[info] Generate code for 0 queries
You need to have actual queries.
Out of curiosity: why did you use the "Sangria" style?
from sbt-graphql.
Should not it use the introspected target/graphql/starwars.graphql
file?
Maybe I'm getting this project wrong, I'm looking for something that would generate the sangria case classes from a .graphql
file.
from sbt-graphql.
I think I understand your confusion now! Correct me if I'm wrong:
You want case classes for every object/input type with all fields that are defined in your schema.
This is not how this plugin works and IMHO not as graphql is supposed to be used.
A case class is generated from two inputs
- A
graphql
file, like these in the test project. The query contains the fields that should be resolved and the optional input variables. - A graphql schema, which is used to get the type information for the requested fields in the
graphql
query file
This means a case class is always bound to a single graphql
query file, which is one of the core ideas of graphql. You only request the data you are interested in. The case class represents exactly the query fields.
Does this help 😄
from sbt-graphql.
Thanks for your answer, I think I'm starting getting it 😁
I think I understand your confusion now! Correct me if I'm wrong:
You want case classes for every object/input type with all fields that are defined in your schema.
Yes you're right.
This means a case class is always bound to a single graphql query file
So this is client side code generation ?
This is not how this plugin works and IMHO not as graphql is supposed to be used.
I would be interested to hear more about this, but maybe here is a wrong place to have this discussion.
from sbt-graphql.
Yes, this is client side code generation 😊
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
- Multiple schemas generation, is it possible? HOT 8
- 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.