elasticio / odata2openapi

OData to OpenAPI Converter
https://www.elastic.io
MIT License
33 stars 23 forks source link

How to convert EDMX xml from a file #19

Open ajopjo opened 6 years ago

ajopjo commented 6 years ago

Hi: I try to convert an edmx file to OpenAPI specification and I got the following error. The below is my test code:

fs.readFile('test.xml', function (err, data) { if (!err) { console.log('data is' + data); parse(data) .then(entitySets => convert(entitySets)) .then(swagger => console.log(JSON.stringify(swagger, null, 2))) .catch(error => console.error(error)); } });

**TypeError: Cannot read property 'include' of undefined test.zip

Attached is the file I try to convert

**

jorgt commented 6 years ago

To make it work with an EDMX file, I found that entitySets is actually defined as a child property, which lead me to add the line entitySets = entitySets.entitySets || entitySets; to convert.js on line 522 and 878, in methods pathsRecursive and convert respectively.

Now I have a swagger file from a metadata.xml file.

I can open a pull request later but I'm not sure if this has any impact on any other type of files.