Scalaxb ignore unknown fields

176 Views Asked by At

When your server have added new fields for response your client will fail if we don't let scalaxb know to ignore unknown fields its like @JsonIgnore in jackson.

1

There are 1 best solutions below

1
On

For this it has a very solution. Just add scalaxbIgnoreUnknown in (Compile, scalaxb) := true in your build tool sample code for build.sbt

```lazy val helloModule = (project in file(".")).settings(
commonSettings,
publishSetting,
scalaxbIgnoreUnknown in (Compile, scalaxb) := true,
scalaxbDispatchVersion in (Compile, scalaxb) := vDispatch,
scalaxbPackageName in (Compile, scalaxb)     := "com.hello.helloModule.client",
libraryDependencies := Seq(
      "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.4",
      "org.scala-lang.modules" %% "scala-swing" % "2.0.0-M2",


      "net.databinder.dispatch" %% "dispatch-core" % vDispatch,
      "com.typesafe" % "config" % "1.3.1",
  "org.scala-lang.modules" %% "scala-xml" % "1.1.0"
    ),
name := "com.hello.helloModule.client").enablePlugins(ScalaxbPlugin)```