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

reintroduced attributes across namespace generates duplicated field in subtype #174

Closed
ghost opened this Issue Nov 12, 2012 · 2 comments

Comments

Projects
None yet
1 participant
@ghost

ghost commented Nov 12, 2012

// attribute name matches parent in complexType/simpleContent/extension

Hi, I'm trying to generate UBL 2.0 and I keep getting errors around the complex types.
Here is a simple example:

Steps

  1. go into branch gh172-sample into dir gh172-sample/src/main/xsd
  2. define 2 simple schemas

exampleBase.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="exampleBase">
    <xsd:complexType name="ExampleBaseType">
        <xsd:simpleContent>
            <xsd:extension base="xs:string">
                <xsd:attribute name="name" type="xs:string" use="optional">
                </xsd:attribute>
            </xsd:extension>
        </xsd:simpleContent>
    </xsd:complexType>
</xsd:schema>

and
example.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:udt="exampleBase"
targetNamespace="example">
    <xsd:import namespace="exampleBase" schemaLocation="exampleBase.xsd"/>
    <xsd:complexType name="exampleType">
        <xsd:simpleContent>
            <xsd:restriction base="udt:ExampleBaseType">
                <xsd:attribute name="name" type="xs:string" use="optional">
                </xsd:attribute>
            </xsd:restriction>
        </xsd:simpleContent>
    </xsd:complexType>
</xsd:schema>
  1. compile

problem

src_managed/main/generated/example.scala:7: attrName is already defined as value attrName
[error]   attrName: Option[String] = None) extends ExampleBaseTypable
[error]   ^
[error] one error found

which is caused by example.scala being generated as:

case class ExampleType(value: String,
  attrName: Option[String] = None,
  attrName: Option[String] = None) extends ExampleBaseTypable

expectation

example.scala should look like:

case class ExampleType(value: String,
  attrName: Option[String] = None) extends ExampleBaseTypable

eed3si9n added a commit that referenced this issue Nov 30, 2012

@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Nov 30, 2012

Owner

This was happening when attributes were merged across different namespace.

Owner

eed3si9n commented Nov 30, 2012

This was happening when attributes were merged across different namespace.

@eed3si9n eed3si9n closed this Nov 30, 2012

eed3si9n added a commit that referenced this issue Dec 2, 2012

@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Dec 10, 2012

Owner

scalaxb 1.0.0-RC3 is out with the fix.

Owner

eed3si9n commented Dec 10, 2012

scalaxb 1.0.0-RC3 is out with the fix.

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