Skip to content

Commit 10d2e5d

Browse files
committed
Document additional imports setting
1 parent 225fde2 commit 10d2e5d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ You can configure the output in various ways
243243
* `name in graphqlCodegen` - Used as a module name in the `Sangria` code generator.
244244
* `graphqlCodegenJson` - Generate JSON encoders/decoders with your graphql query. Default is `JsonCodec.None`.
245245
Note that not all styles support JSON encoder/decoder generation.
246+
* `graphqlCodegenImports: Seq[String]` - A list of additional that are included in every generated file
246247

247248

248249
#### JSON support
@@ -263,6 +264,25 @@ In your `build.sbt` you can configure the JSON library with
263264
graphqlCodegenJson := JsonCodec.Circe
264265
```
265266

267+
#### Scalar types
268+
269+
The code generation doesn't know about your additional scalar types.
270+
sbt-graphql provides a setting `graphqlCodegenImports` to add an import to every
271+
generated query object.
272+
273+
Example:
274+
275+
```
276+
scalar ZoneDateTime
277+
```
278+
279+
which is represented as `java.time.ZoneDateTime`. Add this as an import
280+
281+
```sbt
282+
283+
graphqlCodegenImports += "java.time.ZoneDateTime"
284+
```
285+
266286
#### Codegen style Apollo
267287

268288
As the name suggests the output is similar to the one in apollo codegen.

0 commit comments

Comments
 (0)