mulesoft-labs / api-console-cli

A CLI tools for the API console.
Other
14 stars 15 forks source link

Required `json` property not found. #18

Closed torsjonas closed 6 years ago

torsjonas commented 6 years ago

In api-console version 0.2.6, running api-console build --json api.raml gives the following output

  Building the API console. This may take a moment.
error:
error: Required `json` property not found.
error: Error: Required `json` property not found.
    at Object.module.exports.parse (/usr/local/lib/node_modules/api-console-cli/node_modules/raml2obj/index.js:39:27)
    at JsonGenerator.enhance (/usr/local/lib/node_modules/api-console-cli/node_modules/api-console-builder/node_modules/raml-json-enhance-node/lib/json-generator.js:90:24)
    at parse.then (/usr/local/lib/node_modules/api-console-cli/node_modules/api-console-builder/node_modules/raml-json-enhance-node/lib/json-generator.js:60:26)
    at <anonymous>

Running api-console generate-json --verbose api.raml gives the following output

Parsing RAML...
RAML loaded, generating JSON.
Enhancing JSON...
  Required `json` property not found.

Error: Required `json` property not found.
    at Object.module.exports.parse (/usr/local/lib/node_modules/api-console-cli/node_modules/raml2obj/index.js:39:27)
    at JsonGenerator.enhance (/usr/local/lib/node_modules/api-console-cli/node_modules/raml-json-enhance-node/lib/json-generator.js:90:24)
    at parse.then (/usr/local/lib/node_modules/api-console-cli/node_modules/raml-json-enhance-node/lib/json-generator.js:60:26)
    at <anonymous>

It seems this can be fixed by updating the npm package dependencies. The problem goes away if I manually update the package.json raml-json-enhance-node dependency to ^0.3.0 in api-console-cli here https://github.com/mulesoft-labs/api-console-cli/blob/master/package.json#L34 (this fixes api-console generate-json --verbose api.raml)

and same for sub module api-console-builder (this fixes api-console build --json api.raml)

ericwood73 commented 6 years ago

We're still waiting for this PR to be merged to fix this issue in master, correct?

jarrodek commented 6 years ago

Fixed by https://github.com/mulesoft-labs/api-console-cli/commit/b96481553599857b6d10369e6c89034915a989c9

mduesterhoeft commented 6 years ago

Thanks for the fix.

I observe the following with 0.29.0. This use case works.

api-console build --json api.raml
api-console serve build/

But using the dev command still fails with with:

api-console dev api.raml 

Required `json` property not found.
ginus commented 6 years ago

@mduesterhoeft Error: Required json property not found. at Object.module.exports.parse (/Users/art/.nvm/versions/node/v8.9.0/lib/node_modules/api-console-cli/node_modules/api-console-dev-preview/node_modules/raml2obj/index.js:39:27) at JsonGenerator.enhance (/Users/art/.nvm/versions/node/v8.9.0/lib/node_modules/api-console-cli/node_modules/api-console-dev-preview/node_modules/raml-js-data-provider/node_modules/raml-json-enhance-node/lib/json-generator.js:90:24) at parse.then (/Users/art/.nvm/versions/node/v8.9.0/lib/node_modules/api-console-cli/node_modules/api-console-dev-preview/node_modules/raml-js-data-provider/node_modules/raml-json-enhance-node/lib/json-generator.js:60:26) at so api-console-dev-preview/node_modules/raml-js-data-provider/node_modules/raml-json-enhance-node use 0.2.0 still, before my PR merged, u can change the version in your location.

jarrodek commented 6 years ago

@mduesterhoeft and @ginus I have updated the CLI tool with updated versions of the dependencies. Now it works as intended. Sorry for not fixing it with this issue.

mduesterhoeft commented 6 years ago

@jarrodek thanks a lot. It is working now.