https://github.com/aappddeevv/sbt-graphql-apollo-gen-scala
Use the apollo code generator to create scala sources from graphql operations and schema.
https://github.com/aappddeevv/sbt-graphql-apollo-gen-scala
Last synced: about 1 year ago
JSON representation
Use the apollo code generator to create scala sources from graphql operations and schema.
- Host: GitHub
- URL: https://github.com/aappddeevv/sbt-graphql-apollo-gen-scala
- Owner: aappddeevv
- Created: 2020-02-12T13:13:12.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-22T16:07:54.000Z (over 6 years ago)
- Last Synced: 2025-02-10T05:25:58.192Z (over 1 year ago)
- Language: Scala
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Generate graphql Artifacts
Generate graphql artifacts using the apollo code generator.
To use, add the following:
```scala
// plugins.sbt
resolvers += Resolver.bintrayIvyRepo("aappddeevv", "sbt-plugins")
addSbtPlugin("ttg" % "sbt-graphql-apollo-gen-scala" % "")
```
Then in your build.sbt:
```scala
// build.sbt
...project def...
.enablePlugin(ApolloCodegenPlugin)
.setting(graphQLPackageName := "org.blah") // defaults to project normalized name
```
By default, the plugin looks for graphql sources at `/src/main/graphql/*.graphql`.
It is assumed that the schema file is called `schema.json`. The schema file can be
generated using the apollo cli as well.
See the plugin code for various settings to customize the code
generation process, e.g., the schema file or the output package name.
Don't forget to install the apollo tooling CLI via npm :-)
```sh
# install to local project folder with a package.json already present
npm i apollo
```
Instead of this plugin you could use the watch facility in apollo codegen
directly and ensure that you pickup all your files accordingly and set
the output file correctly into the src_generated directory or a well-known
location of your choosing to ensure a rebuild as needed.
# License
MIT license.