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

kie-issues#665: xml-parser-ts Doesn't manage Complex Types with Simple Content #2039

Merged
merged 10 commits into from
Nov 6, 2023

Conversation

yesamer
Copy link
Contributor

@yesamer yesamer commented Nov 6, 2023

Closes apache/incubator-kie-issues#665

The problem:

xml-parser-ts it's not able to manage Complex Types with Simple Content, please consider the following example:

XML
<rawValue class="string">Above speed limit: 10km/h and 30 km/h</rawValue>

XSD

<xsd:complexType name="rawValueType">
    <xsd:simpleContent>
      <xsd:extension base="xsd:string">
        <xsd:attribute type="xsd:string" name="class" />
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>

Generated type:

export type SceSim__rawValueType =   {

}

Fields are missing

At Runtime:

rawValue: 
@_class: "string"

The solution (kudos to @tiagobento )
For any text value, we are going to provide a new __$$text. This will impact any TextContent, in order to unify the text content management. That means, any simple type that previously held text content, now holds an Object with a __$$text field.

Current generated type:

export type SceSim__rawValueType =   {
@_class: string
__$$text: string
}

Fields are missing

At Runtime:

rawValue: 
@_class: "string"
__$$text: "value"

@tiagobento tiagobento merged commit e177a6a into apache:main Nov 6, 2023
8 checks passed
@yesamer yesamer deleted the kie-issues#665-II branch November 6, 2023 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

xml-parser-ts Doesn't manage Complex Types with Simple Content
2 participants