scalaxb 1.12.5 English
updates
-
fix: Parse named
xs:anyTypeelements by name by @thijsnissen in #718
fix: Parse named xs:anyType elements by name by @thijsnissen in #718
fix: Fixes generated code on Scala 3 by @mrdziuban in #697
fix: Adds the ability to specify --jaxb-package that was missing for mvn-scalaxb by @lciolecki in #699
sbt-scalaxb 1.12.3 is cross published to sbt 1.x and 2.x.
scalaxb 1.12.2 is released
scalaxb 1.12.2 adds support for Dispatch 2.x, contributed by @urwithsumit in #677
scalaxb 1.12.1 is released.
Continuing the theme from scalaxb 1.12.0, scalaxb 1.12.1 improves the code generation for Scala 3. In #654 Matt Dziuban contributed a fix to stop passing in an implicit parameter explicitly, which started to fail to compile on Scala 3.5.0 without using marker.
In #661 @eed3si9n further improved the Scala 3 compatibility enough to pass -Xfatal-warnings with basic usages on LTS Scala 3.3.3 and non-LTS Scala 3.5.0:
xs: _* to xs*self: A with B => to self: A & B =>value startsWith "{" to Java-style value.startsWith("{") notation_ to Java-style null_ to ?Full release note is at https://github.com/eed3si9n/scalaxb/releases/tag/v1.12.1
httpclients_http4s_0_22.scala.template by @kevin-lee in #601Full Changelog: https://github.com/eed3si9n/scalaxb/compare/v1.11.0...v1.11.1
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.
globalSettings by @eed3si9n in #597Full Changelog: https://github.com/eed3si9n/scalaxb/compare/v1.9.1...v1.11.0
Full Changelog: https://github.com/eed3si9n/scalaxb/compare/v1.9.0...v1.9.1
scalaxb.scala #584 by @bodduv$ sbt new eed3si9n/scalaxb.g8
scalaxbUseLists セッティングを追加して Seq[A] の代わりに List[A] を生成できるようにした #526 by @pgrandjean
生成されたコードで複数の引数を取る中置記法を使わないようにする修正 #531 by @margussipria
enum が生成する fromString メソッドが大きすぎてコンパイルできない問題の回避として分けるようにした #517 by @LolHens
Big decimal のフォーマットを XML Schema に準拠するよう修正した。 #483 by @danslapman
String と Option[String] が比較されていたのを修正した。 #485 by @lespea
One-way SOAP 呼び出しを修正した。 #493 by @danslapman
ExecutionContext parameter is added to all methods returning Future[A], instead of hardcoding a execution context. #482 inspired by #407.Starting scalaxb 1.7.0, an explicit import of ExecutionContext would be required as follows:
import scala.concurrent.ExecutionContext.Implicits._
scalaxb 1.7.0 adds option to encode symbols.
lazy val scalaxbCapitalizeWords = settingKey[Boolean]("Attempts to capitalize class and attribute names to match the CamelCase convention")
lazy val scalaxbSymbolEncodingStrategy = settingKey[SymbolEncodingStrategy.Value]("Specifies the strategy to encode non-identifier characters in generated class names")
object SymbolEncodingStrategy extends Enumeration {
val Discard = Value("discard")
val SymbolName = Value("symbol-name")
val UnicodePoint = Value("unicode-point")
val DecimalAscii = Value("decimal-ascii")
val Legacy151 = Value("legacy-1.5.1")
}
#461 by @hosamaly
anyAttribute #470 by @hosamalyscalaxbEnumNameMaxLength for enum name length #480 by @mrdziubanGigahorse サポートの追加。 #413 by @alexdupre
Scala 2.12 クロスビルディング。 #413/#419 by @alexdupre and @dwijnand
xsd:byte 型による 00 を取り扱えるようになった。 #388 by @anatoliykmetyuk--mutable オプションを追加した。詳細は後ほど。xs:any の変換。 #389 by @anatoliykmetyuk--autopackages オプションの追加。 #391 by @anatoliykmetyuk--visitor オプションの追加。 #392 by @anatoliykmetyukscalaxb 1.5.0 より sbt-scalaxb は auto plugin 化される。
scalaxbSettings 追加して、sourceGenerators in Compile する代わりに、ScalaxbPlugin を有効化するだけでよくなった。
他の全てのセッティングやタスクは “scalaxb” とプレフィックスされる。
例えば、以前の packageName というキーは scalaxbPackageName に変更された。
Before:
import ScalaxbKeys._
lazy val root = (project in file(".")).
settings(
name := "foo-project").
settings(scalaxbSettings).
settings(
sourceGenerators in Compile += (scalaxb in Compile).taskValue,
packageName in (Compile, scalaxb) := "generated"
// packageNames in (Compile, scalaxb) := Map(uri("http://something/") -> "something"),
// logLevel in (Compile, scalaxb) := Level.Debug
)
After:
lazy val root = (project in file(".")).
enablePlugins(ScalaxbPlugin).
settings(
name := "foo-project",
scalaxbPackageName in (Compile, scalaxb) := "generated"
// scalaxbAutoPackages in (Compile, scalaxb) := true
)
scalaxb 1.5.0 は可変な case class を生成するオプションを追加する。
case class Address(var name: String,
var street: String,
var city: String)
sbt-scalaxb では以下のように有効化できる:
lazy val root = (project in file(".")).
enablePlugins(ScalaxbPlugin).
settings(
name := "foo-project",
scalaxbPackageName in (Compile, scalaxb) := "generated",
scalaxbGenerateMutable in (Compile, scalaxb) := true
)
バグ報告や pull request によって scalaxb の改善にお手伝いしていただいた皆さんにこの場を借りてお礼します。
git shortlog -sn --no-merges 1.4.1..release/1.5.0 によると今回のリリースでは以下の方々にコントリビュートしてもらった (敬称略): Anatoliy Kmetyuk (@anatoliykmetyuk), Eugene Yokota (@eed3si9n), Andre Van Delft (@AndreVanDelft), Jan-Kees van Andel (@jankeesvanandel), Joshua Reese (@joshlreese), and Mateusz Kołodziejczyk (@coutoPL).
defaultDispatchVersion も 0.11.3 へと変更した。 #352 by @DustinChaloupkaHere’s a list of users who are using scalaxb, or have at some point.
Non-blocking SOAP feature was also contributed by @hoff2 from Banno.
Scoozie: Creating Big Data Workflows at Klout
Additionally, we would like to provide a shout-out to a great open-source project, scalaxb, an sbt plugin that takes .xsd files and creates matching Scala case classes. Scoozie populates these case classes, which are then automatically converted to XML by scalaxb. This plugin saved a lot of headache in the actual process of conversion to XML.
Dispatch forms the foundation of an in-house SOAP client at Novus together with scalaxb. Thanks to these tools our standard response to “Can you do SOAP?” is “Bring it on!” instead of “Ew, what’s this on my shoe?!”
Using Salat with scalaxb generated classes:
scalaxb generates Scala case classes from XSDs and generates supporting helpers for going back and forth from case class to XML. Salat provides an interface to MongoDB based on case classes.
There are a couple hurdles, but both project owners have taken our suggestions seriously, and have smoothed out quite a few bumps.
DispatchHttpClients に requestTimeout と connectionTimeout を追加した。 #304 by @eed3si9n--no-dispatch-client オプション (generateDispatchClient := false) を追加した。 #322 by @liffHttp(request > as.scalaxb[A]) をサポートするための --dispatch-as オプション (generateDispatchAs := true) を追加した。 #332 by @arkadius--ignore-unknown オプション (ignoreUnknown := true) を追加した。 #310 by @jet-blackSeq を使う --no-varargs オプションを追加した。 #292/#309 by @lbruand and @Erwan56CompilerMatcher の Windows でのファイル名やパス処理を修正した。 #307 by @joesciiscalaxb 1.4.0 によって生成されるコードから警告が出ないように修正が加えられた。
-Xfatal-warnings オプションを追加した。 #343 by @eed3si9nバグ報告や pull request によって scalaxb の改善にお手伝いしていただいた皆さんにお礼を言いたい。
git shortlog -sn --no-merges 1.3.0..release/1.4.0 によると今回のリリースでは 10人にコントリビュートしてもらった (敬称略):
Eugene Yokota (@eed3si9n), @jet-black, Olli Helenius (@liff), Lucas Bruand (@lbruand), Markus Klink (@justjoheinz), Carl Livermore (@carl297r), Arek Burdach (@arkadius), Joe Barnes (@joescii), @Erwan56, Roman Parykin (@donderom)
faultactor を String に変更。 #268 by @rubbish22 case classes をデフォルトで生成するようにした。 #280
attributes フィールドでデフォルトで生成するようにした。 #286nillable な fault の取り扱いを修正した。 #284http のインスタンスを lazy に変更した。 #279 by @rubbishtoString を実装した。 #278scalaxb 1.3.0 より、デフォルトで >22 な case class が生成されるようになる。さらに、全ての属性は attribute フィールドにまとめられる。
従来の振る舞いに戻したい場合は以下の設定を行う:
contentsSizeLimit in (Compile, scalaxb) := 20
namedAttributes in (Compile, scalaxb) := true
これに関連して、1.3.0 は属性のデフォルト値の取り扱いを修正した。 #288
Thanks to YourKit for supporting scalaxb! YourKit Java Profiler works great for profiling Scala applications.
scalaxb 1.2.0 より Scala 2.11.x をサポートするようになった。Scala 2.11 は XML とパーサコンビネータをモジュール化するため、追加で設定が必要になった。以下は sbt 0.13 のマルチプロジェクト構文を使った例だ:
import ScalaxbKeys._
lazy val scalaXml = "org.scala-lang.modules" %% "scala-xml" % "1.0.2"
lazy val scalaParser = "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.1"
lazy val dispatchV = "0.11.2" // change this to appropriate dispatch version
lazy val dispatch = "net.databinder.dispatch" %% "dispatch-core" % dispatchV
lazy val root = (project in file(".")).
settings(scalaxbSettings: _*).
settings(
name := "hello",
organization := "com.example",
scalaVersion := "2.11.1",
libraryDependencies ++= Seq(scalaXml, scalaParser, dispatch),
packageName in (Compile, scalaxb) := "com.paperstreet",
packageNames in (Compile, scalaxb) := Map(uri("http://schemas.microsoft.com/2003/10/Serialization/") -> "microsoft.serialization"),
dispatchVersion in (Compile, scalaxb) := dispatchV,
async in (Compile, scalaxb) := true,
sourceGenerators in Compile <+= scalaxb in Compile
// logLevel in (Compile, scalaxb) := Level.Debug
)
これは SOAP コード生成に関連したバグ修正に的を絞ったリリースだ。詳細は SOAP を使うを参照。 .
xs:AnyType の処理を修正した。 #265asFaultのエラーを修正した。 #264 reported by @romainreuillonHttpClientsAsync にて concurrent.Future を使うように修正した。 #269 reported by @hedefalk--blocking というコマンドラインオプションを追加した。scalaxb パッケージを別名にマスクした。scalaxb 1.2.0 よりデフォルトでノンブロッキングな SOAP コードを生成がされるようになった。これまでの Either[X, A] の代わりに SOAP 呼び出しは Future[A] を返し、もし Fault がある場合は Future の失敗として投げられる。
// default
def getQuote(symbol: Option[String]): Future[stockquote.GetQuoteResponse]
// async in (Compile, scalaxb) := false
def getQuote(symbol: Option[String]): Either[scalaxb.Fault[Any], stockquote.GetQuoteResponse]
この機能は @jlavallee と @hoff2 によって #213/#259 としてコントリビュートされた。詳細は soap を使う を参照。
DatatypeFactory を ThreadLocal にキャッシュするようにした。 #243 contributed by @malaportemix 属性が正しく継承されない問題を修正した。 #228 reported by @choffmeisterunbounded が入れ子になったときに、パーサが終了しない問題を修正した。 #230 reported by @FranklinChenxs:element が default および minOccurs = 1 であるときの処理を修正した。 #245 reported by @albokoxs:enumeration の値が非常に長い場合の処理を修正した。 #247 reported by @jcrankyxs:element の名前にシンボルが入っていて、かつ --class-prefix が渡されたときの処理を修正した。 #251 reported by @romangarciaxs:group のパーサが複数回継承される問題を修正した。 #238 reported by @choeger