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

Hi Andrew! #21

Closed CanonTino closed 4 years ago

CanonTino commented 4 years ago

Firstable, thank you for this great library. Nice work!

Secondable; I'd like to ask you about this particular error:

jsonSchemaFile.js:185 Uncaught TypeError: path.parse is not a function at new JsonSchemaFile (jsonSchemaFile.js:185) at new JsonSchemaFileDraft04 (jsonSchemaFileDraft04.js:21) at new JsonSchemaFileDraft06 (jsonSchemaFileDraft06.js:21) at new JsonSchemaFileDraft07 (jsonSchemaFileDraft07.js:20) at NamespaceManager.addNewJsonSchema (namespaceManager.js:132) at Xsd2JsonSchema. (xsd2JsonSchema.js:257) at Array.forEach () at Xsd2JsonSchema.processSchemas (xsd2JsonSchema.js:254) at Xsd2JsonSchema.processAllSchemas (xsd2JsonSchema.js:284)

I went to the specified line and this is what it is all about:
const filePath = path.parse(options.baseFilename);

I don't know if this has aver happened to you or any body else.

Thank you so much in advance.

andrewbober commented 4 years ago

@CanonTino Thank you for the feedback. Could you possibly share the schema being converted so I can try to reproduce the issue?

CanonTino commented 4 years ago

@andrewbober I'm actually reproducing the 'QuieckStart' Example at https://www.npmjs.com/package/xsd2jsonschema

andrewbober commented 4 years ago

@CanonTino Oh wow. I'm sorry you're experiencing this. Could you please share the OS, Node, & NPM versions you're using?

CanonTino commented 4 years ago

@andrewbober sorry for answering till now. I was got into a hurry. I'm using: node v10.15.3 npm 6.4.1 yarn 1.17.3 macOS Mojave: 10.14.3

andrewbober commented 4 years ago

Hi @CanonTino,

I downloaded Node v10.15.3 and tried to duplicate the problem and found the Quickstart example ran fine for me. Here's my setup:

Here are the steps I used to test from within a temporary directory:

  1. git clone https://github.com/andrewbober/xsd2jsonschema.git
  2. cd xsd2jsonschema
  3. npm install
  4. node examples/hello-world.js

Do the above steps work for you? Could you please provide the steps you're taking to install and use xsd2JsonSchema including dependancies?

CanonTino commented 4 years ago

Hi @andrewbober I think the problem might be related to yarn. I replicated the exact same code within another project which is not using yarn and it worked just fine. Thanks so much for your help, time and the information you provided; it was really helpful.

andrewbober commented 4 years ago

Great to hear @CanonTino! Thanks for using Xsd2JsonSchema.