sbt-graphql
sbt-graphql copied to clipboard
Support query code gen for scala.js client
It would be great if we can do so. At the moment, I am not sure how to achieve that.
Thanks for your feature request 🤗
What do you exactly mean? The generated sources should work for the JVM and scala.js. A shared project could contain all queries, which can be reused on both sides.
The Apollo style generation generates self contained query/mutation objects, so you don't have to worry about any "how to get the query from source" issues 😎
Thanks for the quick reply,
For Apollo style, the generated code contains import sangria.macros._. I don't think sangria has published artifact for scala.js. https://mvnrepository.com/artifact/org.sangria-graphql/sangria
For Sangria code gen style, I believe I had some trouble with scalar type when the generated code doesn't seem to include the type so it could not be compiled.
For Apollo style, the generated code contains
import sangria.macros._.I don't think sangria has published artifact for scala.js
Ah, true. We only need that for the document parsing. If we can make this configurable to only use a string, the it would work.
Maybe we can tweak the Apollo style in this direction.
For Sangria code gen with scalar type, I will try to use ScalarAlias to see if it work and report back here.
So 'ScalarAliasworks but notScalarType`.
Thanks for the clarification.
The recent #26 is about the missing support for ScalarType