fnogatz / xsd2json

Translate XML Schema into equivalent JSON Schema
MIT License
149 stars 28 forks source link

xsd2json produces empty output or hangs #124

Closed ekzobrain closed 12 months ago

ekzobrain commented 3 years ago

Hi.

Trying to use xsd2json binary on mac os just hangs on attached XSD. When using on Debian Stretch it returns empty output.

What is wrong with this XSD or is this a bug?

RNI_ZY_1.0.1.xsd.txt

marc1n commented 3 years ago

The same on Ubuntu 20.10, SWI-Prolog version 8.2.1 for x86_64-linux.

marc1n commented 3 years ago

The command swipl -g main /home/marcinr/.local/bin/lib/node_modules/xsd2json/lib-pl/cli.pl -- ~/Downloads/RNI_ZY_1.0.1.xsd.txt hangs as well.

marc1n commented 3 years ago

I suspect that it actually does not hang but it is running really slow. After reducing the complexity of the attached file I've managed to generate JSON in about one minute (using compiled binary).

marc1n commented 3 years ago

Well, the full XSD attached is actually converting in 3 minutes on AMD Ryzen 3 3200G 3,6GHz, 16GB RAM, Ubuntu 20.10.

bora-fsd commented 2 years ago

I hit the same issue and figured out why this might be happening. The description field in my case is repeating:

"PrefrdMtd": {
      "description":"PreferredMethod\nPreferred method used to reach the contact.\nPreferred method used to reach the contact.\nPreferredMethod\nPreferred method used to reach the contact.\nPreferred method used to reach the contact.\nPreferredMethod\nPreferred method used to reach the contact.\nPreferred method used to reach the contact.\nPreferredMethod\nPreferred method used to reach the contact.\nPreferred method used to reach the contact.\nPreferredMethod\nPreferred method used to reach the contact.

and it goes on and on for each description field. Looks like some kind of loop out of control.