GithubHelp home page GithubHelp logo

Comments (6)

ralfhandl avatar ralfhandl commented on June 29, 2024

Hi @imWildCat,

Could you try running the tool via

$ npx odata-openapi3 ./ms-api.xml

This works fine on my machine with the latest ms-graph-v1.0.edmx:

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---          13/06/2023    17:30        2181042 ms-graph-v1.0.edmx
-a---          13/06/2023    17:30      148161187 ms-graph-v1.0.openapi3.json

Thanks in advance!

from odata-openapi.

imWildCat avatar imWildCat commented on June 29, 2024

Thanks for the reply, @ralfhandl !

➜  Edge_Downloads npx odata-openapi3 ./metadata.xml
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/odata-openapi3 - Not found
npm ERR! 404
npm ERR! 404  'odata-openapi3@*' is not in this registry.
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in: /Users/[user]/.npm/_logs/2023-06-13T17_38_53_009Z-debug-0.log
➜  Edge_Downloads npm install -g odata-openapi


added 6 packages in 569ms

1 package is looking for funding
  run `npm fund` for details
➜  Edge_Downloads npx odata-openapi3 ./metadata.xml
./metadata.openapi3.json
/Users/[user]/.nvm/versions/node/v16.17.1/lib/node_modules/odata-openapi/lib/edm.js:120
        element = element.find(
                          ^

TypeError: Cannot read properties of undefined (reading 'find')
    at module.exports.EDM.#processAnnotations (/Users/[user]/.nvm/versions/node/v16.17.1/lib/node_modules/odata-openapi/lib/edm.js:120:27)
    at module.exports.EDM.#processSchemas (/Users/[user]/.nvm/versions/node/v16.17.1/lib/node_modules/odata-openapi/lib/edm.js:101:31)
    at module.exports.EDM.addDocument (/Users/[user]/.nvm/versions/node/v16.17.1/lib/node_modules/odata-openapi/lib/edm.js:32:25)
    at Object.module.exports.csdl2openapi (/Users/[user]/.nvm/versions/node/v16.17.1/lib/node_modules/odata-openapi/lib/csdl2openapi.js:69:9)
    at convert (/Users/[user]/.nvm/versions/node/v16.17.1/lib/node_modules/odata-openapi/lib/cli.js:89:23)
    at Object.<anonymous> (/Users/[user]/.nvm/versions/node/v16.17.1/lib/node_modules/odata-openapi/lib/cli.js:68:3)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
➜  Edge_Downloads

from odata-openapi.

ralfhandl avatar ralfhandl commented on June 29, 2024

@imWildCat please try in a package where you've already installed odata-openapi, for example

mkdir foo
cd foo
npm init -yes
npm install odata-openapi
npx odata-openapi3 -h

That should list the usage options.

Or without installing the package, use

npx --package odata-openapi odata-openapi3 -h

from odata-openapi.

imWildCat avatar imWildCat commented on June 29, 2024

Thanks!

Still similar issue:

➜  f npm init -yes
npm install odata-openapi
npx odata-openapi3 -h
Wrote to /Users/[user]/Downloads/Edge_Downloads/f/package.json:

{
  "name": "f",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}



added 6 packages, and audited 7 packages in 520ms

1 package is looking for funding
  run `npm fund` for details

found 0 vulnerabilities
Usage: odata-openapi3 <options> <source file>
Options:
 --basePath              base path (default: /service-root)
 -d, --diagram           include YUML diagram
 -h, --help              show this info
 --host                  host (default: localhost)
 -o, --openapi-version   3.0.0 to 3.0.3 or 3.1.0 (default: 3.0.2)
 -p, --pretty            pretty-print JSON result
 --scheme                scheme (default: http)
 -t, --target            target file (default: source file basename + .openapi3.json)
 --skipBatchPath         skips the generation of the $batch path, (default: false)
 --title                 default title if none is annotated
 --description           default description if none is annotated
➜  f ls
metadata.xml      node_modules      package-lock.json package.json
➜  f npx odata-openapi3 ./metadata.xml
➜  f cat package.json
{
  "name": "f",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "odata-openapi": "^0.23.0"
  }
}
➜  f npx odata-openapi3 ./metadata.xml
./metadata.openapi3.json
/Users/[user]/Downloads/Edge_Downloads/f/node_modules/odata-openapi/lib/edm.js:120
        element = element.find(
                          ^

TypeError: Cannot read properties of undefined (reading 'find')
    at module.exports.EDM.#processAnnotations (/Users/[user]/Downloads/Edge_Downloads/f/node_modules/odata-openapi/lib/edm.js:120:27)
    at module.exports.EDM.#processSchemas (/Users/[user]/Downloads/Edge_Downloads/f/node_modules/odata-openapi/lib/edm.js:101:31)
    at module.exports.EDM.addDocument (/Users/[user]/Downloads/Edge_Downloads/f/node_modules/odata-openapi/lib/edm.js:32:25)
    at Object.module.exports.csdl2openapi (/Users/[user]/Downloads/Edge_Downloads/f/node_modules/odata-openapi/lib/csdl2openapi.js:69:9)
    at convert (/Users/[user]/Downloads/Edge_Downloads/f/node_modules/odata-openapi/lib/cli.js:89:23)
    at Object.<anonymous> (/Users/[user]/Downloads/Edge_Downloads/f/node_modules/odata-openapi/lib/cli.js:68:3)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
➜  f

I also tried node.js 18:

➜  f nvm use 18
Now using node v18.10.0 (npm v8.19.2)
➜  f npx odata-openapi3 ./metadata.xml
./metadata.openapi3.json
/Users/[user]/Downloads/Edge_Downloads/f/node_modules/odata-openapi/lib/edm.js:120
        element = element.find(
                          ^

TypeError: Cannot read properties of undefined (reading 'find')
    at #processAnnotations (/Users/[user]/Downloads/Edge_Downloads/f/node_modules/odata-openapi/lib/edm.js:120:27)
    at #processSchemas (/Users/[user]/Downloads/Edge_Downloads/f/node_modules/odata-openapi/lib/edm.js:101:31)
    at module.exports.EDM.addDocument (/Users/[user]/Downloads/Edge_Downloads/f/node_modules/odata-openapi/lib/edm.js:32:25)
    at module.exports.csdl2openapi (/Users/[user]/Downloads/Edge_Downloads/f/node_modules/odata-openapi/lib/csdl2openapi.js:69:9)
    at convert (/Users/[user]/Downloads/Edge_Downloads/f/node_modules/odata-openapi/lib/cli.js:89:23)
    at Object.<anonymous> (/Users/[user]/Downloads/Edge_Downloads/f/node_modules/odata-openapi/lib/cli.js:68:3)
    at Module._compile (node:internal/modules/cjs/loader:1149:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1203:10)
    at Module.load (node:internal/modules/cjs/loader:1027:32)
    at Module._load (node:internal/modules/cjs/loader:868:12)

Node.js v18.10.0

metadata.xml.zip

from odata-openapi.

ralfhandl avatar ralfhandl commented on June 29, 2024

@imWildCat

Bug is fixed with [email protected].

Thanks for finding this!

from odata-openapi.

imWildCat avatar imWildCat commented on June 29, 2024

@ralfhandl thank you so much!

from odata-openapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.