scalaxb

scalaxb is an XML data-binding tool for Scala that supports W3C XML Schema (xsd) and Web Services Description Language (wsdl) as the input file.

status

The latest is Maven Central

Many things still may not work. I'd really appreciate if you could run it against your favorite xsd file and let me know the result.

usage

$ scalaxb [options] <schema_file>...
 
  -d <directory> | --outdir <directory>
        generated files will go into <directory>
  -p <package> | --default-package <package>
        specifies the target package
  --package:<namespaceURI>=<package>
        specifies the target package for <namespaceURI>
  --class-prefix <prefix>
        prefixes generated class names
  --param-prefix <prefix>
        prefixes generated parameter names
  --prepend-family
        prepends family name to class names
  --wrap-contents <complexType>
        wraps inner contents into a seperate case class
  --contents-limit <size>
        defines long contents to be segmented (default: 20)
  --chunk-size <size>
        segments long sequences into chunks (default: 10)
  --package-dir
        generates package directories
  --protocol-file <name.scala>
        protocol file name (xmlprotocol.scala)
  --protocol-package <package>
        package for protocols
  --no-runtime
        skips runtime files
  --lax-any
        relaxes namespace constraints of xs:any
  --blocking
        generates blocking SOAP client
  --dispatch-version <version>
        version of Dispatch (default: 0.11.1)
  -v | --verbose
        be extra verbose
  --help
        display this message
  --version
        display version info
  <schema_file>...
        input schema to be converted

sponsors

Thanks to YourKit for supporting scalaxb! YourKit Java Profiler works great for profiling Scala applications.

scalaxb 1.12.1

scalaxb 1.12.1 is released.

Scala 3 compatibility improvements

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:

  • Passing sequence to a vararg was changed from xs: _* to xs*
  • Self type with refinement was changed from self: A with B => to self: A & B =>
  • Added indentations where there were an offside "Line is indented too far to the left" warning
  • Rewrote some infix usages like value startsWith "{" to Java-style value.startsWith("{") notation
  • Variable initialization was changed from _ to Java-style null
  • Wildcard type argument was changed from _ to ?

Full release note is at https://github.com/eed3si9n/scalaxb/releases/tag/v1.12.1

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 #613

updates

  • Updates Monocle by @xuwei-k in #612
  • Adds Scala 3 build setting by @xuwei-k in #623
  • Uses ClassTag instead of Manifest by @xuwei-k in #608

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.2

  • Fixes "match may not be exhaustive." error on Scala 2.13 #565 by @kovstas
  • Fixes the code generation of attribute accessor to add attribute prefix #318/#558 by @etitov

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
Syndicate content