【问题标题】:Scalaxb ignore unknown fieldsScalaxb 忽略未知字段
【发布时间】:2019-02-22 04:50:00
【问题描述】:

当您的服务器为响应添加新字段时,如果我们不让 scalaxb 知道忽略未知字段(例如 jackson 中的 @JsonIgnore),您的客户端将失败。

【问题讨论】:

    标签: scala scalaxb sbt-scalaxb


    【解决方案1】:

    为此它有一个非常好的解决方案。只需在 build.sbt 的构建工具示例代码中添加 scalaxbIgnoreUnknown in (Compile, scalaxb) := true

    ```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)```
    

    【讨论】:

    猜你喜欢
    • 2021-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-01
    • 2015-12-06
    • 1970-01-01
    • 2016-06-06
    • 2016-07-12
    相关资源
    最近更新 更多