Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Flatten nested Options in generated code #112

OlegYch opened this Issue Nov 8, 2011 · 3 comments


None yet
4 participants

OlegYch commented Nov 8, 2011


Compile a schema with the following declaration

<xsd:element minOccurs="0" name="Definition" nillable="true"  type="xsd:string"/>


Generated code contains nested Options

case class Whatever(Definition = Option[Option[String]])


case class Whatever(Definition = Option[String])


Please add an option to flatten Options in generated code.
Since most of the time web service client/server do not care about difference between nil element and absence of element it should be possible to ignore this in generated code as well.
Referring discussion at http://groups.google.com/group/scalaxb/browse_thread/thread/1aa78cd28929f9d7

@eed3si9n eed3si9n was assigned Nov 8, 2011

rtyley commented Jul 10, 2014

As a workaround, can we (as users) just alter the WSDL?? ie go from:

<element minOccurs="0" maxOccurs="1" name="Id" nillable="true" type="zns:ID" />


<element minOccurs="0" maxOccurs="1" name="Id" type="zns:ID" />

...dropping the nillable??


eed3si9n commented Jul 10, 2014

@rtyley scalaxb generates a parser that parses nil value when nillable is set to true, so dropping it would risk runtime error if you get a document that contains it.


This would also be helpful on my end, all of our types are nested option types (Option[Option[T]])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment