scalaxb

scalaxbはScalaのためのXMLデータバインディングツールで,W3C XML Schema (xsd) や Web Services Description Language (wsdl) から case class を生成します。

現在の状況

最新版は Maven Central です。
結構色々ちゃんと機能してない所があります。好みのスキーマからScalaコードを生成してみて結果を報告してもらえると助かります。

用法

$ scalaxb [オプション] <スキーマファイル>...
 
  -d <ディレクトリ> | --outdir <ディレクトリ>
        ファイルは<ディレクトリ>に生成される
  -p <パッケージ> | --default-package <パッケージ>
        対象パッケージを指定する
  --package:<名前空間URI>=<パッケージ>
        <名前空間URI>の対象パッケージを指定する
  --class-prefix <プレフィックス>
        生成されるクラス名のプレフィックスを指定する
  --param-prefix <プレフィックス>
        生成される仮引数名のプレフィックスを指定する
  --prepend-family
        クラス名にファミリー名を前置する
  --wrap-contents <複合型名>
        別の case class に追い出す複合型を指定する
  --contents-limit <サイズ>
        区分けされる長いコンテンツの上限を指定する (デフォルト: 20)
  --chunk-size <サイズ>
        区分けされた一区切りのサイズ (デフォルト: 10)
  --package-dir
        パッケージの構成のディレクトリを生成する
  --protocol-file <name.scala>
        プロトコルのファイル名 (xmlprotocol.scala)
  --protocol-package <パッケージ>
        プロトコルの対象パッケージ
  --no-runtime
        ランタイムファイルを省く
  --lax-any
        xs:any の名前空間の制約を緩和する
  --blocking
        ブロッキングする SOAP クライアントを生成する
  --dispatch-version <version>
        Dispatch バージョン (デフォルト: 0.11.1)
  -v | --verbose
        デバッグ用うるさいモード
  --help
        このメッセージを表示する
  --version
        バージョン情報を表示する
  <スキーマファイル>...
        変換されるスキーマファイル

1.12.0

scalaxbJaxbPackage

scalaxb 1.12.0 supports choosing javax or jakarta for jaxb package name

Compile / scalaxbJaxbPackage := JaxbPackage.Jakarta

This was contributed by @mrdziuban in https://github.com/eed3si9n/scalaxb/pull/613

updates

behind the scene

scalaxb 1.11.1

updates

  • Fixes soap12_tagless template for Scala 3 by @zarthross in #600
  • Fixes soap11_tagless template for Scala 3 by @ebar in #602
  • Adds support for http4s 0.22.x client generation - httpclients_http4s_0_22.scala.template by @kevin-lee in #601

new contributors

  • @kevin-lee made their first contribution in #601
  • @ebar made their first contribution in #602

Full Changelog: https://github.com/eed3si9n/scalaxb/compare/v1.11.0...v1.11.1

scalaxb 1.11.0

http4s client + tagless final style

scalaxb 1.11.0 adds support for http4s client generation.

ThisBuild / organization  := "com.example"
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / scalaVersion := "2.13.10"
ThisBuild / scalaxbPackageName := "generated"
ThisBuild / scalaxbGenerateDispatchClient := false
ThisBuild / scalaxbGenerateHttp4sClient := true
 
lazy val scalaXml = "org.scala-lang.modules" %% "scala-xml" % "2.1.0"
lazy val scalaParser = "org.scala-lang.modules" %% "scala-parser-combinators" % "2.2.0"
lazy val jaxbApi = "javax.xml.bind" % "jaxb-api" % "2.3.0"
lazy val emberClient= "org.http4s" %% "http4s-ember-client" % "0.23.18"
 
lazy val root = (project in file("."))
  .enablePlugins(ScalaxbPlugin)
  .settings(
    name := "soap",
    libraryDependencies ++= Seq(scalaXml, scalaParser, jaxbApi, emberClient),
  )

This was contributed by Darren Gibson (@zarthross) in #596.

updates

  • Moves setting key default values to globalSettings by @eed3si9n in #597

behind the scene

  • Add scripted test by @eed3si9n in #598

new contributors

Full Changelog: https://github.com/eed3si9n/scalaxb/compare/v1.9.1...v1.11.0

scalaxb 1.9.1

updates

  • Adds Scala 3 support by enumerating transitive self types in the generated code by @fthomas in #595

behind the scene

  • Fixes mvn scalaxb doc links by @danielchen2 in #594

new contributors

  • @danielchen2 made their first contribution in #594
  • @fthomas made their first contribution in #595

Full Changelog: https://github.com/eed3si9n/scalaxb/compare/v1.9.0...v1.9.1

scalaxb 1.9.0

updates

  • Updates scala-xml to 2.x, and scala-parser-combinators to 2.x on Scala 2.13 #589 by @mrdziuban
  • Fixes type mismatch in scalaxb.scala #584 by @bodduv

behind the scene

quick start

$ sbt new eed3si9n/scalaxb.g8

scalaxb 1.8.3

scalaxb 1.8.1

bug fixes

  • Fixes whitespace handling when whitespace = collapse #556 by @jypma
  • Fixes reserved word handling for Monocle lens generation #539 by @deenar
  • Fixes Monocle lens generation when complexType and element are named the same #555 by @ihhha
  • Fixes random access performance in ElemNameSeqReader #544 by @omatzcoveo
  • Fixes SOAP action encoding #548 by @etitov

scalaxb 1.8.0

scalaxb 1.8.0 は Monocle Lens 生成機能を追加する。

scalaxb 1.7.5

  • toXML(...)xsi:type 属性を書き出すようにした #518 by @abestel
  • scalaxbUseLists セッティングを追加して Seq[A] の代わりに List[A] を生成できるようにした #526 by @pgrandjean
  • 生成されたコードで複数の引数を取る中置記法を使わないようにする修正 #531 by @margussipria
  • enum が生成する fromString メソッドが大きすぎてコンパイルできない問題の回避として分けるようにした #517 by @LolHens
Syndicate content