GithubHelp home page GithubHelp logo

Comments (12)

hwang123 avatar hwang123 commented on May 29, 2024 1

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.

muuki88 avatar muuki88 commented on May 29, 2024

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.

hwang123 avatar hwang123 commented on May 29, 2024

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.

muuki88 avatar muuki88 commented on May 29, 2024

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.

muuki88 avatar muuki88 commented on May 29, 2024

@hwang123 did you have any luck finding out the issue?

from sbt-graphql.

muuki88 avatar muuki88 commented on May 29, 2024

Sounds reasonable 👍

from sbt-graphql.

markarasev avatar markarasev commented on May 29, 2024

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.

muuki88 avatar muuki88 commented on May 29, 2024

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.

markarasev avatar markarasev commented on May 29, 2024

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.

muuki88 avatar muuki88 commented on May 29, 2024

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

  1. A graphql file, like these in the test project. The query contains the fields that should be resolved and the optional input variables.
  2. 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.

markarasev avatar markarasev commented on May 29, 2024

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.

muuki88 avatar muuki88 commented on May 29, 2024

Yes, this is client side code generation 😊

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.