Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default values for elements missing from generated classes #353

Open
pferdwurst opened this issue Sep 28, 2015 · 0 comments
Open

Default values for elements missing from generated classes #353

pferdwurst opened this issue Sep 28, 2015 · 0 comments

Comments

@pferdwurst
Copy link

I noticed that the default values for my element parameters in my schema are not getting translated into the generated case classes.

For example, I have the following xsd snippet:

<complexType name="Foo">
    <sequence>
        <element name="size" type="string" default="large"/>
        <element minOccurs="0" name="color" type="string"/>
        <element minOccurs="0" name="id" type="long"/>
    </sequence>
</complexType>

This is generating the following case class:

case class Foo(size: String,
  color: Option[String] = None,
  id: Option[Long] = None)

Notice there is no default value for the "size" parameter.

My use case is that I am trying to serialize a json string into this case class and cannot make use of any default constructor parameters even though my schema defines them.

Internally we have patched GenSource in order to include the default values but are not entirely confident that there are no adverse side-effects from our modification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant