Skip to content

wix-incubator/sangria-jackson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sangria jackson marshalling.

Build Status

Not yet released.

Usage

Create marshalling support with your instance of ObjectMapper

package com.example

object Jackson {
  val marshalling = com.wix.sangria.marshalling.jackson.forObjectMapper(objectMapper)
}

Import marshalling._ where you need to use it. ToInput instances are automatically derived for all types. FromInput instances have to be declared manually:

package com.example

import marshalling._

object FromInputs {
  implicit def articleFromInput = jacksonFromInput[Article]
}

Note: It's up to you to make sure that the object mapper can serialize and deserialize values in the format defined in the graphql schema. This means that you probably need to use the [jackson-scala-module][https://github.com/FasterXML/jackson-module-scala] and annotate enum values inside case classes with [@JsonScalaEnumeration][https://github.com/FasterXML/jackson-module-scala/wiki/Enumerations] annotations.

License

sangria-json4s-jackson is licensed under Apache License, Version 2.0.

About

Sangria Jackson marshalling

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages