Closed jgrodskiy-donlen closed 8 years ago
Thanks for reporting it. Could you add how your XSD uses xs:annotation
?
At the moment, the plugin expects the following format:
<xs:annotation>
<xs:documentation>
Documentation here.
</xs:documentation>
</xs:annotation>
NP, You doing me a favor by getting this working. If i knew how to debug coffee script I'd get you more data. For now console.log does the trick.
Issue 1. If you have a large block right under schema for annotation.
<xs:annotation>
<xs:documentation>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Nulla non orci eget nunc ullamcorper venenatis.
Proin eget dui nec velit malesuada imperdiet eget vel risus.
Mauris elementum justo ut erat vulputate, nec molestie ante aliquam.
Aliquam sagittis mi at ornare pharetra.
Praesent ut erat mollis, fermentum risus nec, scelerisque nisl.
(A) + (B) = (V) . D
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Nulla non orci eget nunc ullamcorper venenatis.
Proin eget dui nec velit malesuada imperdiet eget vel risus.
Mauris elementum justo ut erat vulputate, nec molestie ante aliquam.
Aliquam sagittis mi at ornare pharetra.
Praesent ut erat mollis, fermentum risus nec, scelerisque nisl.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Nulla non orci eget nunc ullamcorper venenatis.
Proin eget dui nec velit malesuada imperdiet eget vel risus.
Mauris elementum justo ut erat vulputate, nec molestie ante aliquam.
Aliquam sagittis mi at ornare pharetra.
Praesent ut erat mollis, fermentum risus nec, scelerisque nisl.
</xs:documentation>
</xs:annotation>
Issue 2 happens with a single documentation bracket. This is dumb on our part but it does happen.
`
</xsd:annotation>`
And that crashes in xsdParser.coffee @ normalizeString in the str.replace because str is a empty JS object {}.
I think I have found the cause of the initial crash TypeError: Cannot read property 'name' of undefined
. This will happen if there is a tag of any type just after the root element of the XSD without the attribute name
. Does your XSD have something similar? Does it make sense? As far as I know, every complexType
, simpleType
, ... must contain the name
attribute. In e751bce I have fixed the crash by skipping tags without the attribute.
Regarding the other issues: 1.- As you can see in this screenshot it's not crashing for me. Could the problem be related to the previous comment?
2.- Fixed in 5dad9c6, I will update the plugin soon. EDIT: 0.8.2 released.
Yes it is exactly why it is happening. We had one annotation at the root just describing the overall xsd structure.
In that case, this should be fixed with the latest version. I am closing the issue, please reopen if it's happening again.
Uncaught TypeError: Cannot read property 'name' of undefined