Releases: eed3si9n/scalaxb
1.12.1
Scala 3 compatibility improvements
Continuing the theme from 1.12.0, scalaxb 1.12.1 improves the code generation for Scala 3. In #654 @mrdziuban 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: _*
toxs*
- Self type with refinement was changed from
self: A with B =>
toself: 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-stylevalue.startsWith("{")
notation - Variable initialization was changed from
_
to Java-stylenull
- Wildcard type argument was changed from
_
to?
behind the scenes
- Set name of root project to scalaxb-root by @mdedetrich in #648
- Bump org.apache.maven.plugins:maven-compiler-plugin from 3.11.0 to 3.13.0 in /mvn-scalaxb by @dependabot in #653
- Bump org.apache.maven.plugin-tools:maven-plugin-annotations from 3.3 to 3.14.0 in /mvn-scalaxb by @dependabot in #662
- Bump org.apache.maven.plugins:maven-site-plugin from 3.0 to 3.12.1 in /mvn-scalaxb by @dependabot in #646
- Bump org.apache.maven.plugins:maven-invoker-plugin from 1.5 to 3.6.0 in /mvn-scalaxb by @dependabot in #647
- Bump junit:junit from 4.13.1 to 4.13.2 in /mvn-scalaxb by @dependabot in #645
new contributors
- @mdedetrich made their first contribution in #648
Full Changelog: v1.12.0...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 ofManifest
by @xuwei-k in #608
behind the scene
- Avoids
enum
name by @xuwei-k in #610 - Adds JDK 21 test by @xuwei-k in #617
- Adds more Scala versions in scripted test by @xuwei-k in #631
- Adds dependabot setting for Maven plugin by @xuwei-k in #624
- Avoids infix with varargs by @xuwei-k in #611
- Adds parentheses lambda params by @xuwei-k in #607
- Adds explicit type for implicit by @xuwei-k in #614
- Uses string interpolation. fix warnings by @xuwei-k in #615
- Avoids xml pattern match by @xuwei-k in #620
- Fixes warnings in
project/common.scala
by @xuwei-k in #609 - Fixes procedure syntax by @xuwei-k in #616
- Refactors CompilerMatcher.scala by @xuwei-k in #618
- Updates INSTALL.md by @xuwei-k in #619
- Adds Maven plugin test in ci.yml by @xuwei-k in #621
- Uses string interpolation instead of format method by @xuwei-k in #633
- Fixes URL by @xuwei-k in #634
- Uses slash syntax instead of deprecated
in
by @xuwei-k in #635 - Deprecates
CaseClassTooLong
exception by @xuwei-k in #636 - Removes unnecessary
_ match
by @xuwei-k in #637 - Bump actions/checkout from 3 to 4 by @dependabot in #605
- Bump actions/setup-java from 3 to 4 by @dependabot in #643
- Bump maven.version from 2.0.9 to 2.2.1 in /mvn-scalaxb by @dependabot in #626
- Bump org.apache.maven.plugins:maven-release-plugin from 2.2.2 to 3.0.1 in /mvn-scalaxb by @dependabot in #639
- Bump org.codehaus.plexus:plexus-utils from 3.0.17 to 3.0.24 in /mvn-scalaxb by @dependabot in #604
- Deletes
cli/offline.sbt.txt
by @xuwei-k in #622 - Removes old scala version build settings by @xuwei-k in #630
- Fixes
Line is indented too far to the left
warnings in Scala 3 by @xuwei-k in #625 - Update sbt plugins by @xuwei-k in #632
- Bump org.apache.maven.plugins:maven-compiler-plugin from 2.3.2 to 3.11.0 in /mvn-scalaxb by @dependabot in #628
new contributors
Full Changelog: v1.11.1...v1.12.0
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: v1.11.0...v1.11.1
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 @zarthross in #596.
updates
behind the scene
new contributors
- @zarthross made their first contribution in #596
Full Changelog: v1.9.1...v1.11.0
1.9.1
updates
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: v1.9.0...v1.9.1
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 setup
$ sbt new eed3si9n/scalaxb.g8
new contributors
Full Changelog: v1.8.3...v1.9.0
1.8.3
What's Changed
- Fixes handling of complexType named
package
by @eed3si9n in #581 - Adds Coursier instructions by @chadselph in #571
- Fixes some easy warnings by @eed3si9n in #582
New Contributors
- @chadselph made their first contribution in #571
Full Changelog: v1.8.1...v1.8.3
1.8.2
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
1.8.0
scalaxb 1.8.0 adds Monocle Lens generation feature.
setup
Using the sbt-scalaxb this can be enabled as:
val monocleCore = "com.github.julien-truffaut" %% "monocle-core" % "2.0.3"
// val monocleMacro = "com.github.julien-truffaut" %% "monocle-macro" % "2.0.3"
val scalaXml = "org.scala-lang.modules" %% "scala-xml" % "1.3.0"
val scalaParser = "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2"
val dispatchV = "0.12.0"
val dispatch = "net.databinder.dispatch" %% "dispatch-core" % dispatchV
ThisBuild / organization := "com.example"
ThisBuild / scalaVersion := "2.12.8"
lazy val root = (project in file("."))
.enablePlugins(ScalaxbPlugin)
.settings(
name := "foo",
libraryDependencies ++= Seq(dispatch, scalaXml, scalaParser, monocleCore),
Compile / scalaxb / scalaxbDispatchVersion := dispatchV,
Compile / scalaxb / scalaxbPackageName := "com.example.ipo",
Compile / scalaxb / scalaxbGenerateLens := true,
Compile / scalaxb / scalaxbUseLists := true,
)
generated code
This will generate Lenses in the companion objects as follows:
case class PurchaseOrderType(shipTo: ipo.Addressable,
billTo: ipo.Addressable,
comment: Option[String] = None,
items: ipo.Items,
attributes: Map[String, scalaxb.DataRecord[Any]] = Map.empty) {
lazy val orderDate = attributes.get("@orderDate") map { _.as[javax.xml.datatype.XMLGregorianCalendar]}
}
object PurchaseOrderType {
def shipTo: monocle.Lens[PurchaseOrderType, ipo.Addressable] = monocle.Lens[PurchaseOrderType, ipo.Addressable](_.shipTo)((_shipTo: ipo.Addressable) => (purchaseordertype: PurchaseOrderType) => purchaseordertype.copy(shipTo = _shipTo))
def billTo: monocle.Lens[PurchaseOrderType, ipo.Addressable] = monocle.Lens[PurchaseOrderType, ipo.Addressable](_.billTo)((_billTo: ipo.Addressable) => (purchaseordertype: PurchaseOrderType) => purchaseordertype.copy(billTo = _billTo))
def comment: monocle.Lens[PurchaseOrderType, Option[String]] = monocle.Lens[PurchaseOrderType, Option[String]](_.comment)((_comment: Option[String]) => (purchaseordertype: PurchaseOrderType) => purchaseordertype.copy(comment = _comment))
def items: monocle.Lens[PurchaseOrderType, ipo.Items] = monocle.Lens[PurchaseOrderType, ipo.Items](_.items)((_items: ipo.Items) => (purchaseordertype: PurchaseOrderType) => purchaseordertype.copy(items = _items))
def attributes: monocle.Lens[PurchaseOrderType, Map[String, scalaxb.DataRecord[Any]]] = monocle.Lens[PurchaseOrderType, Map[String, scalaxb.DataRecord[Any]]](_.attributes)((_attributes: Map[String, scalaxb.DataRecord[Any]]) => (purchaseordertype: PurchaseOrderType) => purchaseordertype.copy(attributes = _attributes))
implicit class PurchaseOrderTypeW[A](l: monocle.Lens[A, PurchaseOrderType]) {
def shipTo: monocle.Lens[A, ipo.Addressable] = l composeLens PurchaseOrderType.shipTo
def billTo: monocle.Lens[A, ipo.Addressable] = l composeLens PurchaseOrderType.billTo
def comment: monocle.Lens[A, Option[String]] = l composeLens PurchaseOrderType.comment
def items: monocle.Lens[A, ipo.Items] = l composeLens PurchaseOrderType.items
def attributes: monocle.Lens[A, Map[String, scalaxb.DataRecord[Any]]] = l composeLens PurchaseOrderType.attributes
}
}
case class Items(item: List[ipo.Item] = Nil)
object Items {
def item: monocle.Lens[Items, List[ipo.Item]] = monocle.Lens[Items, List[ipo.Item]](_.item)((_item: List[ipo.Item]) => (items: Items) => items.copy(item = _item))
implicit class ItemsW[A](l: monocle.Lens[A, Items]) {
def item: monocle.Lens[A, List[ipo.Item]] = l composeLens Items.item
}
}
usage
Here's an example of how the lenses can be used:
scala> import com.example.ipo._
import com.example.ipo._
scala> val items = Items(Item("a", BigInt(0), BigDecimal(0)) :: Nil)
items: com.example.ipo.Items = Items(List(Item(a,0,0,None,None,Map())))
scala> val po = PurchaseOrderType(Address("", "", ""), Address("", "", ""), None, items)
po: com.example.ipo.PurchaseOrderType = PurchaseOrderType(Address(,,),Address(,,),None,Items(List(Item(a,0,0,None,None,Map()))),Map())
scala> PurchaseOrderType.items.item.set(Item("b", BigInt(0), BigDecimal(0)) :: Nil)(po)
res0: com.example.ipo.PurchaseOrderType = PurchaseOrderType(Address(,,),Address(,,),None,Items(List(Item(b,0,0,None,None,Map()))),Map())
In the above, PurchaseOrderType.items.item
zooms into the item
field of the purchase order's items
field and replaces the value.
This was implemented by @eed3si9n as #535, based on #292 contributed by @lbruand.