thomaspeugeot / gongreqif

0 stars 0 forks source link

Values of spec-object are not properly imported #3

Open thomaspeugeot opened 4 months ago

thomaspeugeot commented 4 months ago

We have

        <SPEC-OBJECT
            IDENTIFIER="_xen_QMkhEee8KsfWrp9EJQ"
            LAST-CHANGE="2017-11-14T15:44:26.000+02:00"
            LONG-NAME="Requirement-1">
          <VALUES>
            <ATTRIBUTE-VALUE-XHTML>
              <DEFINITION>
                <ATTRIBUTE-DEFINITION-XHTML-REF>_25YvEMkyEee5A_N9aQFa1w</ATTRIBUTE-DEFINITION-XHTML-REF>
              </DEFINITION>
              <THE-VALUE>
                <xhtml:div>PUID-1</xhtml:div>
              </THE-VALUE>

that follows definition of xsd

  <xsd:complexType name="SPEC-OBJECT">
    <xsd:all>
      <xsd:element maxOccurs="1" minOccurs="0" name="VALUES">
        <xsd:complexType>
          <xsd:choice maxOccurs="unbounded" minOccurs="0">
            <xsd:element name="ATTRIBUTE-VALUE-BOOLEAN" type="REQIF:ATTRIBUTE-VALUE-BOOLEAN"/>
            <xsd:element name="ATTRIBUTE-VALUE-DATE" type="REQIF:ATTRIBUTE-VALUE-DATE"/>
            <xsd:element name="ATTRIBUTE-VALUE-ENUMERATION" type="REQIF:ATTRIBUTE-VALUE-ENUMERATION"/>
            <xsd:element name="ATTRIBUTE-VALUE-INTEGER" type="REQIF:ATTRIBUTE-VALUE-INTEGER"/>
            <xsd:element name="ATTRIBUTE-VALUE-REAL" type="REQIF:ATTRIBUTE-VALUE-REAL"/>
            <xsd:element name="ATTRIBUTE-VALUE-STRING" type="REQIF:ATTRIBUTE-VALUE-STRING"/>
            <xsd:element name="ATTRIBUTE-VALUE-XHTML" type="REQIF:ATTRIBUTE-VALUE-XHTML"/>
          </xsd:choice>
        </xsd:complexType>
      </xsd:element>
...
  </xsd:complexType>

In the go model, it is

type SPECOBJECT struct {
    Name           string
    VALUES         *VALUES        `xml:"VALUES"`
}

type VALUES struct {
    Name         string
    ENUMVALUEREF []string `xml:"ENUM-VALUE-REF"`
}

so, since gong does not support slice of strings, we loose the link

thomaspeugeot commented 4 months ago

"REQ-IF" is an element and a complex type

<xsd:element name="REQ-IF" type="REQIF:REQ-IF"/>
...
<xsd:complexType name="REQ-IF">
    <xsd:sequence>
...
      <xsd:element maxOccurs="1" minOccurs="1" name="CORE-CONTENT">
        <xsd:complexType>
          <xsd:choice maxOccurs="1" minOccurs="1">
            <xsd:element name="REQ-IF-CONTENT" type="REQIF:REQ-IF-CONTENT"/>
          </xsd:choice>
        </xsd:complexType>
      </xsd:element>
...
    </xsd:sequence>
    <xsd:attribute ref="xml:lang" use="optional"/>
  </xsd:complexType>

xsd says the type is defined a sequence of 3 element, 2 mandatory and one optionnel. The "REQ-IF-CONTENT" type is complex as well.

image

it seems xgen generates a struct for the element and a type for the complexType

thomaspeugeot commented 4 months ago
        <SPEC-OBJECT
            IDENTIFIER="_xen_QMkhEee8KsfWrp9EJQ"
            LAST-CHANGE="2017-11-14T15:44:26.000+02:00"
            LONG-NAME="Requirement-1">
          <VALUES>

          </VALUES>
  <xsd:complexType name="SPEC-OBJECT">
    <xsd:all>
      <xsd:element maxOccurs="1" minOccurs="0" name="VALUES">
        <xsd:complexType>
          <xsd:choice maxOccurs="unbounded" minOccurs="0">
            <xsd:element name="ATTRIBUTE-VALUE-BOOLEAN" type="REQIF:ATTRIBUTE-VALUE-BOOLEAN"/>
            <xsd:element name="ATTRIBUTE-VALUE-DATE" type="REQIF:ATTRIBUTE-VALUE-DATE"/>
            <xsd:element name="ATTRIBUTE-VALUE-ENUMERATION" type="REQIF:ATTRIBUTE-VALUE-ENUMERATION"/>
            <xsd:element name="ATTRIBUTE-VALUE-INTEGER" type="REQIF:ATTRIBUTE-VALUE-INTEGER"/>
            <xsd:element name="ATTRIBUTE-VALUE-REAL" type="REQIF:ATTRIBUTE-VALUE-REAL"/>
            <xsd:element name="ATTRIBUTE-VALUE-STRING" type="REQIF:ATTRIBUTE-VALUE-STRING"/>
            <xsd:element name="ATTRIBUTE-VALUE-XHTML" type="REQIF:ATTRIBUTE-VALUE-XHTML"/>
          </xsd:choice>
        </xsd:complexType>
      </xsd:element>
    </xsd:all>
  </xsd:complexType>