andrewbober / xsd2jsonschema

A pure JavaScript library for translating complex XML Schemas into JSON Schemas.
https://www.xsd2jsonschema.org
Apache License 2.0
47 stars 25 forks source link

Getting started #6

Closed vponraj closed 5 years ago

vponraj commented 6 years ago

Hello,

Just downloaded and while running example, got different errors for mostly similar combination of nodejs/npm but on different OS.

Windows (nodejs - 8.11.1, npm-5.6.0), I got: $ node example/example.js convert example/ExampleTypes.xsd C:\Users\vponraj\Downloads\xsd2jsonschema-master\xsd2jsonschema-master\src\xsd2JsonSchema.js:147 if (xsd.hasIncludes()) { ^

TypeError: Cannot read property 'hasIncludes' of undefined at Xsd2JsonSchema.processSchema (C:\Users\vponraj\Downloads\xsd2jsonschema-master\xsd2jsonschema-master\src\xsd2JsonSchema.js:147:17) at Xsd2JsonSchema. (C:\Users\vponraj\Downloads\xsd2jsonschema-master\xsd2jsonschema-master\src\xsd2JsonSchema.js:163:18) at Array.forEach () at Xsd2JsonSchema.processSchemas (C:\Users\vponraj\Downloads\xsd2jsonschema-master\xsd2jsonschema-master\src\xsd2JsonSchema.js:162:14) at Xsd2JsonSchema.processSchema (C:\Users\vponraj\Downloads\xsd2jsonschema-master\xsd2jsonschema-master\src\xsd2JsonSchema.js:148:18) at Xsd2JsonSchema. (C:\Users\vponraj\Downloads\xsd2jsonschema-master\xsd2jsonschema-master\src\xsd2JsonSchema.js:163:18) at Array.forEach () at Xsd2JsonSchema.processSchemas (C:\Users\vponraj\Downloads\xsd2jsonschema-master\xsd2jsonschema-master\src\xsd2JsonSchema.js:162:14) at Xsd2JsonSchema.processAllSchemas (C:\Users\vponraj\Downloads\xsd2jsonschema-master\xsd2jsonschema-master\src\xsd2JsonSchema.js:176:14) at Object. (C:\Users\vponraj\Downloads\xsd2jsonschema-master\xsd2jsonschema-master\example\example.js:36:12)

Linux (nodejs - 8.11.3, npm-5.6.0), I got: [vponraj@vijayvm xsd2jsonschema-master]$ node example/example.js convert example/ExampleTypes.xsd /home/vponraj/xsd2jsonschema-master/src/depthFirstTraversal.js:62 if (visitor.onBegin(jsonSchema, xsd)) { ^

TypeError: Cannot read property 'onBegin' of undefined at DepthFirstTraversal.traverse (/home/vponraj/xsd2jsonschema-master/src/depthFirstTraversal.js:62:15) at Xsd2JsonSchema.processSchema (/home/vponraj/xsd2jsonschema-master/src/xsd2JsonSchema.js:157:23) at Xsd2JsonSchema. (/home/vponraj/xsd2jsonschema-master/src/xsd2JsonSchema.js:163:18) at Array.forEach () at Xsd2JsonSchema.processSchemas (/home/vponraj/xsd2jsonschema-master/src/xsd2JsonSchema.js:162:14) at Xsd2JsonSchema.processSchema (/home/vponraj/xsd2jsonschema-master/src/xsd2JsonSchema.js:148:18) at Xsd2JsonSchema. (/home/vponraj/xsd2jsonschema-master/src/xsd2JsonSchema.js:163:18) at Array.forEach () at Xsd2JsonSchema.processSchemas (/home/vponraj/xsd2jsonschema-master/src/xsd2JsonSchema.js:162:14) at Xsd2JsonSchema.processAllSchemas (/home/vponraj/xsd2jsonschema-master/src/xsd2JsonSchema.js:176:14)

Have tried different variations of the last parameter, but no change in behavior.

node example/example.js convert example/ ExampleTypes_2016-01-01.xsd node example/example.js convert example/schema/ExampleTypes_2016-01-01.xsd node example/example.js convert example/ExampleTypes_2016-01-01.xsd

What am I missing here?

Thanks in advance.

homerzhou commented 5 years ago

Yes, I have the same problem

cmd: npm run example-convert

xsd2jsonschema@0.0.5 example-convert /home/wenjie/test/nodejs/xsd2jsonschema_test/tmp/xsd2jsonschema node example/example.js convert

/home/wenjie/test/nodejs/xsd2jsonschema_test/tmp/xsd2jsonschema/src/depthFirstTraversal.js:62 if (visitor.onBegin(jsonSchema, xsd)) { ^

TypeError: Cannot read property 'onBegin' of undefined at DepthFirstTraversal.traverse (/home/wenjie/test/nodejs/xsd2jsonschema_test/tmp/xsd2jsonschema/src/depthFirstTraversal.js:62:15) at Xsd2JsonSchema.processSchema (/home/wenjie/test/nodejs/xsd2jsonschema_test/tmp/xsd2jsonschema/src/xsd2JsonSchema.js:157:23) at Xsd2JsonSchema. (/home/wenjie/test/nodejs/xsd2jsonschema_test/tmp/xsd2jsonschema/src/xsd2JsonSchema.js:163:18) at Array.forEach () at Xsd2JsonSchema.processSchemas (/home/wenjie/test/nodejs/xsd2jsonschema_test/tmp/xsd2jsonschema/src/xsd2JsonSchema.js:162:14) at Xsd2JsonSchema.processSchema (/home/wenjie/test/nodejs/xsd2jsonschema_test/tmp/xsd2jsonschema/src/xsd2JsonSchema.js:148:18) at Xsd2JsonSchema. (/home/wenjie/test/nodejs/xsd2jsonschema_test/tmp/xsd2jsonschema/src/xsd2JsonSchema.js:163:18) at Array.forEach () at Xsd2JsonSchema.processSchemas (/home/wenjie/test/nodejs/xsd2jsonschema_test/tmp/xsd2jsonschema/src/xsd2JsonSchema.js:162:14) at Xsd2JsonSchema.processAllSchemas (/home/wenjie/test/nodejs/xsd2jsonschema_test/tmp/xsd2jsonschema/src/xsd2JsonSchema.js:176:14)

andrewbober commented 5 years ago

Thank you for reporting this vponraj & homerzhou. With help from visitbethel this has been fixed.