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

scalaxb 1.8.0

scalaxb 1.8.0 adds Monocle Lens generation feature.

scalaxb 1.7.5

  • Populates xsi:type attribute on toXML(...) #518 by @abestel
  • Adds scalaxbUseLists setting to generate List[A] instead of Seq[A] #526 by @pgrandjean
  • Fixes code generation to avoid multi-arg infix syntax #531 by @margussipria
  • Splits generated fromString method for big enums that would otherwise not compile #517 by @LolHens

scalaxb 1.7.3

enhancement

bug fix

  • Fixes the handling of attributes declared as sequences #512 by @abestel

scalaxb 1.7.2

bug fix

scalaxb 1.7.1

bug fixes

  • Fixes big decimal formatting according to XML Schema #483 by @danslapman
  • Fixes equals called on a String and Option[String] #485 by @lespea
  • Fixes one-way SOAP call #493 by @danslapman

scalaxb 1.7.0

breaking changes

  • 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._

symbol encoding strategy and capitalization

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

other enhancements

  • Handle multiple faults #438 by @SupraFii
  • Adds support for enum values list #446 by @bbarker
  • Supports Dispatch versions from 0.11.4 to 0.14.x #468 by @margussipria
  • Generates a default value for class parameters of anyAttribute #470 by @hosamaly
  • scala-xml 1.1.0 and scala-parser-combinators 1.1.0 #476 by @sullis
  • Uses sealed traits for enums #479 by @mrdziuban
  • Adds config option for setting scalaxbEnumNameMaxLength for enum name length #480 by @mrdziuban

bug fixes

  • Don't throw exception on http status code != 200 to allow Fault parsing #444 by @alexdupre
  • Fixes Soap11Fault bug when empty detail #450 by @dportabella

scalaxb 1.5.2

enhancements

  • Adds support for Gigahorse 0.3 and different backends (OkHttp and AHC) #428 by @alexdupre

bug fixes

  • Splits fromAnySchemaType into smaller chunks to work around JVM code size limit. #429 by @fltt
Syndicate content