Giter Site home page Giter Site logo

lucybot-inc / api-spec-converter Goto Github PK

View Code? Open in Web Editor NEW
1.1K 1.1K 176.0 22.46 MB

Convert API descriptions between popular formats such as OpenAPI(fka Swagger), RAML, API Blueprint, WADL, etc.

Home Page: https://lucybot-inc.github.io/api-spec-converter/

License: MIT License

JavaScript 55.84% RAML 0.56% HTML 3.28% TypeScript 10.59% Dockerfile 0.09% Pug 3.16% SCSS 26.49%

api-spec-converter's People

Contributors

adrolet avatar ashrafmansy avatar bobvanderlinden avatar cjolif avatar davidbiesack avatar dependabot[bot] avatar eonie avatar fivepapertigers avatar fosrias avatar gitter-badger avatar guilhermelimazup avatar hunner avatar impl avatar ioggstream avatar ivangoncharov avatar kevinoid avatar larsbutler avatar lucybot avatar mikeralphson avatar mrguiman avatar oleg-codaio avatar pondermatic avatar rbren avatar romanhotsiy avatar telmojsneves avatar thenorthernpole avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

api-spec-converter's Issues

Browserify - basePath gets set to host?

In browser:

APISpecConverter.convert({
  source: "http://api.apigee.com/v1/consoles/facebook/apidescription?format=wadl",
  from: 'wadl',
  to: 'swagger_2'
}, function(er, res) {console.log('conv', res.spec.basePath)})

prints the current host

Conversion from OpenAPI 3.0 to Swagger 2.0 fails if "components" is missing

I've tried to convert an OpenAPI 3.0 specification to Swagger 2.0:

api-spec-converter -f openapi_3 -t swagger_2 test.json

test.json:

{
  "openapi": "3.0.0",
  "info": {
    "title": "test",
    "version": "1.0"
  },
  "paths": {
    "/": {
      "get": {
        "responses": {
          "default": {
            "description": "test"
          }
        }
      }
    }
  }
}

The conversion fails:

Fatal TypeError: Cannot read property 'securitySchemes' of undefined
    at convertSecurityDefinitions (/api-spec-converter/lib/converters/openapi3_to_swagger2.js:194:62)
    at convert (/api-spec-converter/lib/converters/openapi3_to_swagger2.js:18:3)
    at converters.swagger_2.Promise.method.oa (/api-spec-converter/lib/formats/openapi_3.js:17:26)
    at tryCatcher (/api-spec-converter/node_modules/bluebird/js/release/util.js:16:23)
    at /api-spec-converter/node_modules/bluebird/js/release/method.js:15:34
    at Promise.try (/api-spec-converter/lib/base_format.js:162:12)
    at tryCatcher (/api-spec-converter/node_modules/bluebird/js/release/util.js:16:23)
    at Function.Promise.attempt.Promise.try (/api-spec-converter/node_modules/bluebird/js/release/method.js:39:29)
    at module.exports.BaseFormat.convertTo (/api-spec-converter/lib/base_format.js:154:21)
    at Converter.getSpec.then.fromSpec (/api-spec-converter/index.js:33:32)
    at tryCatcher (/api-spec-converter/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/api-spec-converter/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/api-spec-converter/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/api-spec-converter/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/api-spec-converter/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/api-spec-converter/node_modules/bluebird/js/release/async.js:133:16)

Workaround: Add an empty "components" property, now the conversion succeeds:

{
  "openapi": "3.0.0",
  "info": {
    "title": "Minimal specification",
    "version": "1.0"
  },
  "paths": {
    "/": {
      "get": {
        "responses": {
          "default": {
            "description": "test"
          }
        }
      }
    }
  },
  "components": {
  }
}

Cannot convert valid RAML OAuth 2.0 security with `-c` flag:

With this valid security section in RAML:

#%RAML 0.8 SecurityScheme
description: |
    HMRC supports OAuth 2.0 for authenticating all API requests.
type: OAuth 2.0
describedBy:
    headers:
        Authorization:
            description: |
               Used to send a valid OAuth 2 access token. Do not use
               with the "access_token" query string parameter.
            type: string
    queryParameters:
        access_token:
            description: |
               Used to send a valid OAuth 2 access token. Do not use together with the "Authorization" header
            type: string
    responses:
        401:
            description: |
                Bad or expired token.
        403:
            description: |
                Bad OAuth request (wrong consumer key, bad nonce, expired
                timestamp...). Re-authenticating the user won't help here.
settings:
  authorizationUri: https://api.service.hmrc.gov.uk/oauth2/authorize
  accessTokenUri: https://api.service.hmrc.gov.uk/oauth2/token
  authorizationGrants: [ authorization_code ]
  scopes:
    - self-assesment:read
    - self-assesment:write

Run this

api-spec-converter -f raml -t swagger_2 -d self-assessment-api-granularity-level-2-v1.raml

Get this error:

[
  {
    "code": "ONE_OF_MISSING",
    "params": [],
    "message": "Not a valid securityDefinitions definition",
    "path": [
      "securityDefinitions",
      "oauth_2_0"
    ],
    "schemaId": "http://swagger.io/v2/schema.json#",
    "inner": [
      {
        "code": "OBJECT_ADDITIONAL_PROPERTIES",
        "params": [
          [
            "scopes",
            "tokenUrl",
            "authorizationUrl"
          ]
        ],
        "message": "Additional properties not allowed: scopes,tokenUrl,authorizationUrl",
        "path": [
          "securityDefinitions",
          "oauth_2_0"
        ]
      },
      {
        "code": "OBJECT_MISSING_REQUIRED_PROPERTY",
        "params": [
          "in"
        ],
        "message": "Missing required property: in",
        "path": [
          "securityDefinitions",
          "oauth_2_0"
        ]
      },
      {
        "code": "OBJECT_MISSING_REQUIRED_PROPERTY",
        "params": [
          "flow"
        ],
        "message": "Missing required property: flow",
        "path": [
          "securityDefinitions",
          "oauth_2_0"
        ]
      },
      {
        "code": "OBJECT_MISSING_REQUIRED_PROPERTY",
        "params": [
          "flow"
        ],
        "message": "Missing required property: flow",
        "path": [
          "securityDefinitions",
          "oauth_2_0"
        ]
      },
      {
        "code": "OBJECT_MISSING_REQUIRED_PROPERTY",
        "params": [
          "flow"
        ],
        "message": "Missing required property: flow",
        "path": [
          "securityDefinitions",
          "oauth_2_0"
        ]
      },
      {
        "code": "OBJECT_MISSING_REQUIRED_PROPERTY",
        "params": [
          "flow"
        ],
        "message": "Missing required property: flow",
        "path": [
          "securityDefinitions",
          "oauth_2_0"
        ]
      }
    ]
  }
]

Command line tool : TypeError: Cannot read property 'call' of undefined

When run:

api-spec-converter pisp.apib --from=api_blueprint --to=swagger_2 > swagger.json

I get:

node_modules\api-spec-converter\node_modules\drafter.js\lib\drafter.nomem.js:1
(function (exports, require, module, __filename, __dirname) { ((function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(
typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.drafter=f()}}))((function(){var module;var Module;if(!Module){Module={}}Module["ready"]=f
alse;Module["log"]=(function(text){console.log("drafter.js: "+text)});Module["logErr"]=(function(text){console.error("drafter.js: "+text)});Module["onRuntimeInitialized"]=(function(){this.ready=true});var Module;if(!Module)Module
=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false

TypeError: Cannot read property 'call' of undefined
    at CompositeError.get (C:\Users\cen76482\AppData\Roaming\npm\node_modules\api-spec-converter\node_modules\composite-error\lib\compositeError.js:45:50)
    at CompositeError.formatStackTraces (C:\Users\cen76482\AppData\Roaming\npm\node_modules\api-spec-converter\node_modules\composite-error\lib\compositeError.js:56:23)
    at CompositeError.get (C:\Users\cen76482\AppData\Roaming\npm\node_modules\api-spec-converter\node_modules\composite-error\lib\compositeError.js:25:39)
    at Async.fatalError (C:\Users\cen76482\AppData\Roaming\npm\node_modules\api-spec-converter\node_modules\bluebird\js\release\async.js:50:65)
    at Promise._reject (C:\Users\cen76482\AppData\Roaming\npm\node_modules\api-spec-converter\node_modules\bluebird\js\release\promise.js:652:22)
    at Promise._settlePromise (C:\Users\cen76482\AppData\Roaming\npm\node_modules\api-spec-converter\node_modules\bluebird\js\release\promise.js:584:21)
    at Promise._settlePromise0 (C:\Users\cen76482\AppData\Roaming\npm\node_modules\api-spec-converter\node_modules\bluebird\js\release\promise.js:614:10)
    at Promise._settlePromises (C:\Users\cen76482\AppData\Roaming\npm\node_modules\api-spec-converter\node_modules\bluebird\js\release\promise.js:689:18)
    at Async._drainQueue (C:\Users\cen76482\AppData\Roaming\npm\node_modules\api-spec-converter\node_modules\bluebird\js\release\async.js:133:16)
    at Async._drainQueues (C:\Users\cen76482\AppData\Roaming\npm\node_modules\api-spec-converter\node_modules\bluebird\js\release\async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (C:\Users\cen76482\AppData\Roaming\npm\node_modules\api-spec-converter\node_modules\bluebird\js\release\async.js:17:14)

Issue with converting generic type

Hello!

I'm facing an issue when I'm converting my attached API from Swagger 1.2 to 2.0. The original spec uses List[Mapะ’ยซstring,objectะ’ยป]. The produced spec includes reference to it ("$ref": "#/definitions/Mapโ”ฌะปstring,objectโ”ฌโ•—"), but does not contain the definition itself.

The source and result are attached. Can this be fixed, please?

issue.zip

WADL 'representation' and XSD

First off, thanks for creating this project! I'm helping some colleagues with a conversion from WADL to Swagger_2, but the WADL file references XSDs to define the objects that are returned or expected by the API.

I think that to insert this behavior, one would need to start groveling about here in the WADL converter. Yes?

https://github.com/lucybot/api-spec-converter/blob/master/lib/formats/wadl.js#L162

Anyway, wondered if there is a fork or branch that may have deeper support for bringing the object representations forward into the Swagger "definitions". Or, perhaps there's a better way?

Running Synchronous

This is more of a question - can I run your functions synchronously?

Also - can I pass an object instead of a file name? (The use case here is that I just parsed in a file and figured out it is say Swagger 1.2. I now want to convert it to 2.0, but I don't really want to read it in again).

TypeError converting RAML to Swagger 2

Unfortunately I canโ€™t share my RAML file. If it helps, itโ€™s a little sophisticated; it uses resource types and traits.

$ api-spec-converter api.raml --from=raml --to=swagger_2
TypeError: Error during convertion: Cannot read property 'replace' of undefined
    at Object.exports.convert (/usr/local/lib/node_modules/api-spec-converter/node_modules/raml-to-swagger/src/index.js:14:20)
    at converters.swagger_2 (/usr/local/lib/node_modules/api-spec-converter/lib/types/raml.js:18:35)
    at BaseType.convertTo (/usr/local/lib/node_modules/api-spec-converter/lib/types/base-type.js:125:3)
    at /usr/local/lib/node_modules/api-spec-converter/index.js:37:14
    at /usr/local/lib/node_modules/api-spec-converter/index.js:17:7
    at null.<anonymous> (/usr/local/lib/node_modules/api-spec-converter/lib/types/base-type.js:112:7)
    at null.<anonymous> (/usr/local/lib/node_modules/api-spec-converter/lib/types/base-type.js:42:7)
    at /usr/local/lib/node_modules/api-spec-converter/node_modules/async/lib/async.js:52:16
    at /usr/local/lib/node_modules/api-spec-converter/node_modules/async/lib/async.js:361:13
    at /usr/local/lib/node_modules/api-spec-converter/node_modules/async/lib/async.js:52:16

Also, when I specify --to=swagger_1 I get no output at all.

version 1.4.1 on Node 5.1.0 on Mac OS X 10.11.1.

Error when converting from raml

There is a little error when converting references from raml to swagger.

In my company we use nested references in RAML, but the conversiรณn process assumes the references are all set at the same level. For example, if we have a RAML with a reference like this:

"$ref" : "#/schemas/Person"

what we get when converting is:

"#/definitions/#/schemas/Person"

but we should obtain:

"#/definitions/Person"

Thanks in advance.

Unable to convert behind a corporate proxy

Hello !

api-spec-converter is working as long as I am converting a resource connected to a public network without proxy. I am trying to convert a raml into a swagger 2.0 file.
When I am at work, behind a corporate proxy, I can't have it working properly. Always getting some "connect ETIMEDOUT" errors.

I have to say that my proxy environment variables are set (for http and https) and the https.get is working behind the proxy as soon as I use a https-proxy-agent to do this get.

Looking into the code, the libraries used, and even the requirements from the libraries (raml-parser) I am not so sure proxies are supported at all.

Could you confirm this impression ? if yes, would it make sense to add proxy support to this tool ?

Thanks,
Guillaume

remote repository not found during "npm install"

sudo npm install -g api-spec-converter
npm ERR! git clone --template=/Users/swen/.npm/_git-remotes/_templates --mirror git://github.com/APIs-guru/json-schema-compatibility.git /Users/swen/.npm/_git-remotes/git-github-com-APIs-guru-json-schema-compatibility-git-5fd7aa58: Cloning into bare repository '/Users/swen/.npm/_git-remotes/git-github-com-APIs-guru-json-schema-compatibility-git-5fd7aa58'...
npm ERR! git clone --template=/Users/swen/.npm/_git-remotes/_templates --mirror git://github.com/APIs-guru/json-schema-compatibility.git /Users/swen/.npm/_git-remotes/git-github-com-APIs-guru-json-schema-compatibility-git-5fd7aa58: fatal: remote error:
npm ERR! git clone --template=/Users/swen/.npm/_git-remotes/_templates --mirror git://github.com/APIs-guru/json-schema-compatibility.git /Users/swen/.npm/_git-remotes/git-github-com-APIs-guru-json-schema-compatibility-git-5fd7aa58: Repository not found.

Assertion error while converting WADL to Swagger 2

I am getting an assertion error while trying to convert a WADL source file to it's Swagger 2 representation.

The stack trace is :

at convertType (/usr/local/lib/node_modules/api-spec-converter/lib/types/wadl.js:56:5)
at convertParameter (/usr/local/lib/node_modules/api-spec-converter/lib/types/wadl.js:107:19)
at arrayMap (/usr/local/lib/node_modules/api-spec-converter/node_modules/lodash/index.js:1406:25)
at Function.map (/usr/local/lib/node_modules/api-spec-converter/node_modules/lodash/index.js:6710:14)
at convertMethod (/usr/local/lib/node_modules/api-spec-converter/lib/types/wadl.js:146:29)
at /usr/local/lib/node_modules/api-spec-converter/lib/types/wadl.js:165:30
at arrayEach (/usr/local/lib/node_modules/api-spec-converter/node_modules/lodash/index.js:1289:13)
at Function.<anonymous> (/usr/local/lib/node_modules/api-spec-converter/node_modules/lodash/index.js:3345:13)
at convertResource (/usr/local/lib/node_modules/api-spec-converter/lib/types/wadl.js:163:7)
at /usr/local/lib/node_modules/api-spec-converter/lib/types/wadl.js:184:20

And in the code, it seems to be linked to XSDfiles ( assert(wadlType.indexOf('xsd:') === 0);). I don't really understand that.. Can you give me some more information ?

Postman collection format

It would be nice if the converter can support the postman collection format as well since I am not aware of any way to export to Swagger spec (2.0) from Postman.

Fatal error during converting from RAML

Hello,

I have tried converting RAML file and have got this problem.

api-spec-converter /home/user/api.raml --from=raml --to=swagger_2 > result.json
Fatal AssertionError: undefined == true
at /usr/local/lib/node_modules/api-spec-converter/node_modules/raml-to-swagger/src/index.js:113:7
at /usr/local/lib/node_modules/api-spec-converter/node_modules/lodash/lodash.js:4944:15
at baseForOwn (/usr/local/lib/node_modules/api-spec-converter/node_modules/lodash/lodash.js:3001:24)
at /usr/local/lib/node_modules/api-spec-converter/node_modules/lodash/lodash.js:4913:18
at Function.forEach (/usr/local/lib/node_modules/api-spec-converter/node_modules/lodash/lodash.js:9359:14)
at /usr/local/lib/node_modules/api-spec-converter/node_modules/raml-to-swagger/src/index.js:101:7
at arrayEach (/usr/local/lib/node_modules/api-spec-converter/node_modules/lodash/lodash.js:537:11)
at Function.forEach (/usr/local/lib/node_modules/api-spec-converter/node_modules/lodash/lodash.js:9359:14)
at parseSecuritySchemes (/usr/local/lib/node_modules/api-spec-converter/node_modules/raml-to-swagger/src/index.js:100:5)
at Object.exports.convert (/usr/local/lib/node_modules/api-spec-converter/node_modules/raml-to-swagger/src/index.js:20:26)
at converters.swagger_2.Promise.method.raml (/usr/local/lib/node_modules/api-spec-converter/lib/formats/raml.js:17:41)
at tryCatcher (/usr/local/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/util.js:16:23)
at /usr/local/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/method.js:15:34
at Promise.try (/usr/local/lib/node_modules/api-spec-converter/lib/base_format.js:105:12)
at tryCatcher (/usr/local/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/util.js:16:23)
at Function.Promise.attempt.Promise.try (/usr/local/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/method.js:39:29)

Fail to convert RAML to Swagger 2

When I run this conversion:

api-spec-converter https://raw.githubusercontent.com/vmware/nsxraml/master/nsxvapi.raml --from=raml --to=swagger_2
An error is generated:

Fatal AssertionError: Error during convertion: false == true
    at parseBaseUri (/usr/local/lib/node_modules/api-spec-converter/node_modules/raml-to-swagger/src/index.js:67:3)

I suspect it has to do with the comment

//Don't support other URI templates right now.

Error during convertion: undefined is not a valid argument for URI

First - isn't the error message misspelled? Oh, but that error message is from URI.js.

I'm filing the issue here because api-spec-converter is sending undefined into URI.js.

When trying to convert a WADL to Swagger2 I'm getting this error:

$ api-spec-converter --to swagger_2 --from wadl sep_wadl.xml 
Fatal TypeError: Error during convertion: undefined is not a valid argument for URI
    at new URI (/Users/david/Laplace/ZigBee/docs-13-0201-00-sep-2-uml-model-xsd-wadl/node_modules/api-spec-converter/node_modules/urijs/src/URI.js:54:15)
    at URI (/Users/david/Laplace/ZigBee/docs-13-0201-00-sep-2-uml-model-xsd-wadl/node_modules/api-spec-converter/node_modules/urijs/src/URI.js:46:16)
    at convertToSwagger (/Users/david/Laplace/ZigBee/docs-13-0201-00-sep-2-uml-model-xsd-wadl/node_modules/api-spec-converter/lib/formats/wadl.js:290:17)
    at /Users/david/Laplace/ZigBee/docs-13-0201-00-sep-2-uml-model-xsd-wadl/node_modules/api-spec-converter/lib/formats/wadl.js:20:28
    at tryCatcher (/Users/david/Laplace/ZigBee/docs-13-0201-00-sep-2-uml-model-xsd-wadl/node_modules/api-spec-converter/node_modules/bluebird/js/release/util.js:16:23)
    at /Users/david/Laplace/ZigBee/docs-13-0201-00-sep-2-uml-model-xsd-wadl/node_modules/api-spec-converter/node_modules/bluebird/js/release/method.js:15:34
    at /Users/david/Laplace/ZigBee/docs-13-0201-00-sep-2-uml-model-xsd-wadl/node_modules/api-spec-converter/lib/base_format.js:105:12
    at tryCatcher (/Users/david/Laplace/ZigBee/docs-13-0201-00-sep-2-uml-model-xsd-wadl/node_modules/api-spec-converter/node_modules/bluebird/js/release/util.js:16:23)
    at Function.Promise.attempt.Promise.try (/Users/david/Laplace/ZigBee/docs-13-0201-00-sep-2-uml-model-xsd-wadl/node_modules/api-spec-converter/node_modules/bluebird/js/release/method.js:39:29)
    at BaseFormat.resolveSubResources.Promise.map.BaseFormat.parse.BaseFormat.readSpec.BaseFormat.resolveResources.BaseFormat.convertTo.Promise.try [as convertTo] (/Users/david/Laplace/ZigBee/docs-13-0201-00-sep-2-uml-model-xsd-wadl/node_modules/api-spec-converter/lib/base_format.js:97:21)
    at /Users/david/Laplace/ZigBee/docs-13-0201-00-sep-2-uml-model-xsd-wadl/node_modules/api-spec-converter/index.js:33:32
    at tryCatcher (/Users/david/Laplace/ZigBee/docs-13-0201-00-sep-2-uml-model-xsd-wadl/node_modules/api-spec-converter/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/david/Laplace/ZigBee/docs-13-0201-00-sep-2-uml-model-xsd-wadl/node_modules/api-spec-converter/node_modules/bluebird/js/release/promise.js:504:31)
    at Promise._settlePromise (/Users/david/Laplace/ZigBee/docs-13-0201-00-sep-2-uml-model-xsd-wadl/node_modules/api-spec-converter/node_modules/bluebird/js/release/promise.js:561:18)
    at Promise._settlePromise0 (/Users/david/Laplace/ZigBee/docs-13-0201-00-sep-2-uml-model-xsd-wadl/node_modules/api-spec-converter/node_modules/bluebird/js/release/promise.js:606:10)
    at Promise._settlePromises (/Users/david/Laplace/ZigBee/docs-13-0201-00-sep-2-uml-model-xsd-wadl/node_modules/api-spec-converter/node_modules/bluebird/js/release/promise.js:685:18)

I did a little investigation and did a little modification:

if (typeof root.$.base === 'undefined') {
    console.error('UNDEFINED root.$.base');
    console.error(util.inspect(root));
}
  var baseUrl = URI(root.$.base);

The data output from the util.inspect shows the root.$ object has a resource object but not a base object.

The WADL is the SEP2 WADL from ZigBee which can be retrieved for free from here: http://www.zigbee.org/zigbee-for-developers/applicationstandards/zigbee-2030-5/

Syntax Error: Unexpected token

I am getting this error when I use api-spec-converter to convert from swagger_1 to swagger_2

/usr/local/lib/node_modules/api-spec-converter/index.js:33 .then(fromSpec => fromSpec.convertTo(options.to)) ^^ SyntaxError: Unexpected token => at exports.runInThisContext (vm.js:75:16) at Module._compile (module.js:445:25) at Object.Module._extensions..js (module.js:480:10) at Module.load (module.js:357:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:367:17) at require (module.js:386:17) at Object.<anonymous> (/usr/local/lib/node_modules/api-spec-converter/bin/api-spec-converter:8:17) at Module._compile (module.js:462:26) at Object.Module._extensions..js (module.js:480:10)

Trying to convert from Swagger 1.1 to 2.0

I've attempted this both in JS and from the command line but have encountered the same problem in both.

I use a command similar to:
api-spec-converter https://api.gettyimages.com/swagger/api-docs --from=swagger_1 --to=swagger_2 > swagger.json

Except I point it at the Swagger 1.1 API listing file which looks something like this:

    "swaggerVersion": "1.1",
    "apis": [
        {
            "path": "/Authentication",
            "description": "login, logout of the dashboard, ping the server, error codes"
        },
        {
            "path": "/User",
            "description": "create/update/get/delete/migrate a user, retrieve users public info, password reset"
        },

etc.

The actual definitions of the APIs are contained in separate files corresponding to the path name and in the same directory as the listing file.

The problem
It seems like the tool is trying to navigate to Authentication as if it is in a directory that is under my api-docs.json directory listing file.
Fatal Error: ENOTDIR: not a directory, open 'api-docs/api-docs.json/Authentication

It's trying to open the definitions file as if it is a directory and it's failing.

Has anyone run into this before? Is converting from Swagger 1.1 supported?

Thanks

Merging RAML and Google Discovery converters

Hi,
I'm also working at the same field and implement converter for Google Discovery format.
Also I'm working on RAML converter it's ~80% finished.
If you interested I can merge my code into your project.

P.S. I can't find any license file or file header. Can you specify which license do you use?

Conversion from Swagger 2 to WADL outputs Error: Unable to convert from swagger_2 to wadl

I tried to convert the Swagger 2 Petstore API spec to WADL, and I get the following error message:
Error: Unable to convert from swagger_2 to wadl

api-spec-converter -f swagger_2 -t wadl http://petstore.swagger.io/v2/swagger.json

npm\node_modules\api-spec-converter\node_modules\drafter.js\emcc\drafter.nomem.js:1
(function (exports, require, module, __filename, __dirname) { var Module={"ready
":false,"log":(function(text){console.log("drafter.js: "+text)}),"logErr":(funct
ion(text){console.error("drafter.js: "+text)}),"onRuntimeInitialized":(function(
){this.ready=true})};var Module;if(!Module)Module=(typeof Module!=="undefined"?M
odule:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnPr
operty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=typeof win
dow==="object";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require
==="function"&&!ENVIRONMENT_IS_WEB;var ENVIRONMENT_IS_WORKER=typeof importScript
s==="function";var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NOD
E&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["pr
int"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])
Module["printErr"]=func

Error: Unable to convert from swagger_2 to wadl

Does this mean that conversion from Swagger 2 to WADL is not supported?

TypeError: Error during convertion: Cannot read property 'resources' of undefined

Hi,

I have an error when I run the following code:

var Converter = require('api-spec-converter');

Converter.convert({
    from: 'wadl',
    to: 'swagger_2',
    source: 'http://localhost:9080/rest/application.wadl'
}, function(err, converted) {
    console.trace(err);
});

Here is the stack trace:

Trace: [TypeError: Error during convertion: Cannot read property 'resources' of undefined]
    at L:\mcourbet\dev\git\plq\plq-parent\plq-web\gulpfile.js:54:17
    at L:\mcourbet\dev\git\plq\plq-parent\plq-web\node_modules\api-spec-converter\lib\base-type.js:133:14
    at converters.swagger_2 (L:\mcourbet\dev\git\plq\plq-parent\plq-web\node_modules\api-spec-converter\lib\types\wadl.js:20:14)
    at BaseType.convertTo (L:\mcourbet\dev\git\plq\plq-parent\plq-web\node_modules\api-spec-converter\lib\base-type.js:130:3)
    at L:\mcourbet\dev\git\plq\plq-parent\plq-web\node_modules\api-spec-converter\index.js:37:14
    at L:\mcourbet\dev\git\plq\plq-parent\plq-web\node_modules\api-spec-converter\index.js:17:7
    at null.<anonymous> (L:\mcourbet\dev\git\plq\plq-parent\plq-web\node_modules\api-spec-converter\lib\base-type.js:117:7)
    at null.<anonymous> (L:\mcourbet\dev\git\plq\plq-parent\plq-web\node_modules\api-spec-converter\lib\base-type.js:47:7)
    at L:\mcourbet\dev\git\plq\plq-parent\plq-web\node_modules\async\lib\async.js:52:16
    at L:\mcourbet\dev\git\plq\plq-parent\plq-web\node_modules\async\lib\async.js:361:13

The WADL:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<a:application xmlns:a="http://wadl.dev.java.net/2009/02"><a:doc xmlns:b="http://jersey.java.net/" b:generatedBy="Jersey: 1.19 02/11/2015 05:39 AM"/>
    <a:grammars>
        <a:include href="application.wadl/xsd0.xsd"><a:doc title="Generated" xml:lang="en"/></a:include>
    </a:grammars>
    <a:resources base="http://localhost:9080/rest/">
        <a:resource path="/rmes">
            <a:method id="getRessourcesMetal" name="GET">
                <a:response><a:representation mediaType="application/json"/></a:response>
            </a:method>
            <a:resource path="/{identifiantUm}/{siteUm}"><a:param name="identifiantUm" style="template" xmlns:b="http://www.w3.org/2001/XMLSchema" type="b:string"/><a:param name="siteUm" style="template" xmlns:b="http://www.w3.org/2001/XMLSchema" type="b:string"/>
                <a:method id="get" name="GET">
                    <a:response><a:representation mediaType="application/json"/></a:response>
                </a:method>
                <a:resource path="/categorisations">
                    <a:method id="get" name="GET">
                        <a:response><a:representation mediaType="application/json"/></a:response>
                    </a:method>
                </a:resource>
            </a:resource>
        </a:resource>
        <a:resource path="/Affectation">
            <a:resource path="/articles/{identifiantUm}/{siteUM}"><a:param name="identifiantUm" style="template" xmlns:b="http://www.w3.org/2001/XMLSchema" type="b:string"/><a:param name="siteUM" style="template" xmlns:b="http://www.w3.org/2001/XMLSchema" type="b:string"/>
                <a:method id="rechercherArticle" name="GET">
                    <a:response><a:representation element="bandeauRMVO" mediaType="application/json"/></a:response>
                </a:method>
            </a:resource>
            <a:resource path="/articles">
                <a:method id="rechercherArticle" name="POST">
                    <a:request><a:representation element="resultRechercherArticlePB" mediaType="application/json"/></a:request>
                    <a:response><a:representation element="resultatRechercherArticleVO" mediaType="application/json"/></a:response>
                </a:method>
            </a:resource>
        </a:resource>
        <a:resource path="/apgs">
            <a:resource path="/{numApg: [\p{Alnum}]{1,20}}"><a:param name="numApg" style="template" xmlns:b="http://www.w3.org/2001/XMLSchema" type="b:string"/>
                <a:method id="getApg" name="GET">
                    <a:response><a:representation mediaType="*/*"/></a:response>
                </a:method>
                <a:resource path="/rmes">
                    <a:method id="getRessourcesMetal" name="GET">
                        <a:response><a:representation mediaType="application/json"/></a:response>
                    </a:method>
                    <a:resource path="/{identifiantUm}/{siteUm}"><a:param name="identifiantUm" style="template" xmlns:b="http://www.w3.org/2001/XMLSchema" type="b:string"/><a:param name="siteUm" style="template" xmlns:b="http://www.w3.org/2001/XMLSchema" type="b:string"/>
                        <a:method id="get" name="GET">
                            <a:response><a:representation mediaType="application/json"/></a:response>
                        </a:method>
                        <a:resource path="/categorisations">
                            <a:method id="get" name="GET">
                                <a:response><a:representation mediaType="application/json"/></a:response>
                            </a:method>
                        </a:resource>
                    </a:resource>
                </a:resource>
            </a:resource>
        </a:resource>
    </a:resources>
</a:application>

We have corporate proxy, but I cannot see anything relevant in the stack trace.

Thanks for your help

raml08 schema prop not being imported correctly

For example, a raml like this, the admin schema is not imported correctly:

#%RAML 0.8
baseUri: https://api.example.com
title: Filesystem API
version: 0.1
schemas:
  - Admin User: |
      {
        "type": "object",
        "properties": {
          "input": {
            "required": false,
            "type": "string"
          }
        }
      }
/files:
  get:
    responses:
      200:
        body:
          application/json:
            schema: Admin User

npm install -g fails with permission error

Installation has failed for me twice, on machines with different architectures and node/npm versions.
I get the same error on each platform:

`# npm i -g api-spec-converter
/usr/local/bin/api-spec-converter -> /usr/local/lib/node_modules/api-spec-converter/bin/api-spec converter

[email protected] postinstall /usr/local/lib/node_modules/api-spec-converter/node_modules/jsonpath
node lib/aesprim.js > generated/aesprim-browser.js
sh: generated/aesprim-browser.js: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: node lib/aesprim.js > generated/aesprim-browser.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ โ”‚
โ”‚ Update available 5.3.0 โ†’ 5.4.2 โ”‚
โ”‚ Run npm i -g npm to update โ”‚
โ”‚ โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-09-21T06_47_16_083Z-debug.log`

2017-09-21T06_47_16_083Z-debugLog.txt

Downconverting OpenAPI 3.0.x to 2.0

There's a MIT-licensed converter here.

  • It's designed as an Angular module, but it looks easy to shim if necessary
  • It may be a little simplistic / incomplete in terms of producing valid OpenAPI 2.0 output

UIFaces jpg URLs

The file \dist\api-spec-converter.js contains over 1200 URLs to jpg images.

module["exports"] = [
"https://s3.amazonaws.com/uifaces/faces/twitter/jarjan/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mahdif/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sprayaga/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ruzinav/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/Skyhartman/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/moscoz/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kurafire/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/91bilal/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/igorgarybaldi/128.jpg",
....

They appear to be from the http://uifaces.com/ tool.

Is this a specific subset of user images from uifaces.com? What are those images used for as part of api-spec-converter? The FAQ page at http://web.archive.org/web/20160511190737/http://uifaces.com/faq says the pictures can only be used for mockups.

Conversion from Swagger spec 1.2 to 2.0 adds HTTP 200 response if not present

I didn't see this issue brought up in the other issues, but I am experiencing a problem when i define an API that does not use an HTTP 200 (OK) response, (instead it used a 204), and during conversion a 200 response is added to the output json which an invalid reference.

Example: 1.2 spec:
"responseMessages" : [ {
"code" : 204,
"message" : "No-Content - Updated successfully"
}, {
"code" : 400,
"message" : "Invalid parameters passed",
"responseModel" : "ExceptionModel"
}, {
"code" : 500,
"message" : "An error has occurred",
"responseModel" : "ExceptionModel"
} ]

Converted 2.0 spec
"responses": {
"200": {
"description": "No response was specified",
"schema": {
"$ref": "#/definitions/Response"
}
},
"204": {
"description": "No-Content - Updated successfully"
},
"400": {
"description": "Invalid parameters passed",
"schema": {
"$ref": "#/definitions/ExceptionModel"
}
},
"500": {
"description": "An internal error has occurred",
"schema": {
"$ref": "#/definitions/ExceptionModel"
}
}
}

lucy-console: "SyntaxError: [object Object] is not a valid Swagger API definition"

Hi,

I try to use api-spec-converter (v. 1.8.0) with lucy-console (v. 1.1.1) but I run into the following error (in the web browser console when I reach http://localhost:3000):

SyntaxError: [object Object] is not a valid Swagger API definition

10:32:40,576 SyntaxError: [object Object] is not a valid Swagger API definition
create/<() %5Cminified%5Cjs%5Cconsole.js:1909
[1]</SwaggerParser.prototype.parse/<() %5Cminified%5Cjs%5Cconsole.js:1633
1 %5Cminified%5Cjs%5Cconsole.js:1909:318

I don't know if the problem comes from api-spec-converter that doesn't output Swagger-compliant object, or from lucy-console that cannot handle this particular Swagger specification. The thing is lucy-console works great with the example given in their README.md.

My Gulp task:

var ConsoleApp = require('express')();
var LucyConsole = require('lucy-console');
var Converter = require('api-spec-converter');

gulp.task('view-api', function() {
    Converter.convert({
        from: 'wadl',
        to: 'swagger_2',
        source: 'http://localhost:9080/rest/application.wadl' // returns [0]
    }, function(err, converted) {
        console.log(converted.stringify()); // outputs [1]

        var apiConsole = new LucyConsole({
            swagger: converted.spec
        });

        ConsoleApp.use(apiConsole.router);
        ConsoleApp.listen(3000);
    });
});

[0]

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<application xmlns="http://wadl.dev.java.net/2009/02">
    <doc xmlns:jersey="http://jersey.java.net/" jersey:generatedBy="Jersey: 1.19 02/11/2015 05:39 AM"/>
    <grammars>
        <include href="application.wadl/xsd0.xsd">
            <doc xml:lang="en" title="Generated"/>
        </include>
    </grammars>
    <resources base="http://localhost:9080/rest/">
        <resource path="/Affectation">
            <resource path="/articles/{identifiantUm}/{siteUM}">
                <param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:string" style="template" name="identifiantUm"/>
                <param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:string" style="template" name="siteUM"/>
                <method name="GET" id="rechercherArticle">
                    <response>
                        <ns2:representation xmlns:ns2="http://wadl.dev.java.net/2009/02" xmlns="" mediaType="application/json" element="bandeauRMVO"/>
                    </response>
                </method>
            </resource>
            <resource path="/articles">
                <method name="POST" id="rechercherArticle">
                    <request>
                        <ns2:representation xmlns:ns2="http://wadl.dev.java.net/2009/02" xmlns="" mediaType="application/json" element="resultRechercherArticlePB"/>
                    </request>
                    <response>
                        <ns2:representation xmlns:ns2="http://wadl.dev.java.net/2009/02" xmlns="" mediaType="application/json" element="resultatRechercherArticleVO"/>
                    </response>
                </method>
            </resource>
        </resource>
        <resource path="/rmes">
            <method name="GET" id="getRessourcesMetal">
                <response>
                    <representation mediaType="application/json"/>
                </response>
            </method>
            <resource path="/{identifiantUm}/{siteUm}">
                <param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:string" style="template" name="identifiantUm"/>
                <param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:string" style="template" name="siteUm"/>
                <method name="GET" id="get">
                    <response>
                        <representation mediaType="application/json"/>
                    </response>
                </method>
                <resource path="/categorisations">
                    <method name="GET" id="get">
                        <response>
                            <representation mediaType="application/json"/>
                        </response>
                    </method>
                </resource>
            </resource>
        </resource>
        <resource path="/demandesAffectation">
            <resource path="/{reference}">
                <param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:int" style="template" name="reference"/>
                <method name="GET" id="get">
                    <response>
                        <representation mediaType="application/json"/>
                    </response>
                </method>
            </resource>
        </resource>
        <resource path="/apgs">
            <resource path="/{numApg: [\p{Alnum}]{1,20}}">
                <param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:string" style="template" name="numApg"/>
                <method name="GET" id="getApg">
                    <response>
                        <representation mediaType="application/json"/>
                    </response>
                </method>
                <resource path="/rmes">
                    <method name="GET" id="getRessourcesMetal">
                        <response>
                            <representation mediaType="application/json"/>
                        </response>
                    </method>
                    <resource path="/{identifiantUm}/{siteUm}">
                        <param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:string" style="template" name="identifiantUm"/>
                        <param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:string" style="template" name="siteUm"/>
                        <method name="GET" id="get">
                            <response>
<representation mediaType="application/json"/>
                            </response>
                        </method>
                        <resource path="/categorisations">
                            <method name="GET" id="get">
<response>
    <representation mediaType="application/json"/>
</response>
                            </method>
                        </resource>
                    </resource>
                </resource>
            </resource>
        </resource>
    </resources>
</application>

[1]

{
  "basePath": "/rest/",
  "host": "localhost:9080",
  "paths": {
    "\\Affectation\\articles": {
      "parameters": [],
      "post": {
        "operationId": "rechercherArticle",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful Response"
          }
        }
      }
    },
    "\\Affectation\\articles\\{identifiantUm}\\{siteUM}": {
      "get": {
        "operationId": "rechercherArticle",
        "responses": {
          "200": {
            "description": "Successful Response"
          }
        }
      },
      "parameters": [
        {
          "in": "path",
          "name": "identifiantUm",
          "required": false,
          "type": "string"
        },
        {
          "in": "path",
          "name": "siteUM",
          "required": false,
          "type": "string"
        }
      ]
    },
    "\\apgs\\{numApg: [\\p{Alnum}]{1,20}}": {
      "get": {
        "operationId": "getApg",
        "responses": {
          "200": {
            "description": "Successful Response"
          }
        }
      },
      "parameters": [
        {
          "in": "path",
          "name": "numApg",
          "required": false,
          "type": "string"
        }
      ]
    },
    "\\apgs\\{numApg: [\\p{Alnum}]{1,20}}\\rmes": {
      "get": {
        "operationId": "getRessourcesMetal",
        "responses": {
          "200": {
            "description": "Successful Response"
          }
        }
      },
      "parameters": [
        {
          "in": "path",
          "name": "numApg",
          "required": false,
          "type": "string"
        }
      ]
    },
    "\\apgs\\{numApg: [\\p{Alnum}]{1,20}}\\rmes\\{identifiantUm}\\{siteUm}": {
      "get": {
        "operationId": "get",
        "responses": {
          "200": {
            "description": "Successful Response"
          }
        }
      },
      "parameters": [
        {
          "in": "path",
          "name": "numApg",
          "required": false,
          "type": "string"
        },
        {
          "in": "path",
          "name": "identifiantUm",
          "required": false,
          "type": "string"
        },
        {
          "in": "path",
          "name": "siteUm",
          "required": false,
          "type": "string"
        }
      ]
    },
    "\\apgs\\{numApg: [\\p{Alnum}]{1,20}}\\rmes\\{identifiantUm}\\{siteUm}\\categorisations": {
      "get": {
        "operationId": "get",
        "responses": {
          "200": {
            "description": "Successful Response"
          }
        }
      },
      "parameters": [
        {
          "in": "path",
          "name": "numApg",
          "required": false,
          "type": "string"
        },
        {
          "in": "path",
          "name": "identifiantUm",
          "required": false,
          "type": "string"
        },
        {
          "in": "path",
          "name": "siteUm",
          "required": false,
          "type": "string"
        }
      ]
    },
    "\\demandesAffectation\\{reference}": {
      "get": {
        "operationId": "get",
        "responses": {
          "200": {
            "description": "Successful Response"
          }
        }
      },
      "parameters": [
        {
          "format": "int32",
          "in": "path",
          "name": "reference",
          "required": false,
          "type": "integer"
        }
      ]
    },
    "\\rmes": {
      "get": {
        "operationId": "getRessourcesMetal",
        "responses": {
          "200": {
            "description": "Successful Response"
          }
        }
      },
      "parameters": []
    },
    "\\rmes\\{identifiantUm}\\{siteUm}": {
      "get": {
        "operationId": "get",
        "responses": {
          "200": {
            "description": "Successful Response"
          }
        }
      },
      "parameters": [
        {
          "in": "path",
          "name": "identifiantUm",
          "required": false,
          "type": "string"
        },
        {
          "in": "path",
          "name": "siteUm",
          "required": false,
          "type": "string"
        }
      ]
    },
    "\\rmes\\{identifiantUm}\\{siteUm}\\categorisations": {
      "get": {
        "operationId": "get",
        "responses": {
          "200": {
            "description": "Successful Response"
          }
        }
      },
      "parameters": [
        {
          "in": "path",
          "name": "identifiantUm",
          "required": false,
          "type": "string"
        },
        {
          "in": "path",
          "name": "siteUm",
          "required": false,
          "type": "string"
        }
      ]
    }
  },
  "schemes": [
    "http"
  ],
  "swagger": "2.0"
}

Not support from openapi_3 to swagger_2

From readme, it says to support. But I got this error,

Fatal Error: Unable to convert from openapi_3 to swagger_2
    at Promise.try (/Users/shenghu/.nvm/versions/node/v7.8.0/lib/node_modules/api-spec-converter/lib/base_format.js:160:13)
    at tryCatcher (/Users/shenghu/.nvm/versions/node/v7.8.0/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/util.js:16:23)
    at Function.Promise.attempt.Promise.try (/Users/shenghu/.nvm/versions/node/v7.8.0/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/method.js:39:29)
    at module.exports.BaseFormat.convertTo (/Users/shenghu/.nvm/versions/node/v7.8.0/lib/node_modules/api-spec-converter/lib/base_format.js:154:21)
    at Converter.getSpec.then.fromSpec (/Users/shenghu/.nvm/versions/node/v7.8.0/lib/node_modules/api-spec-converter/index.js:33:32)
    at tryCatcher (/Users/shenghu/.nvm/versions/node/v7.8.0/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/shenghu/.nvm/versions/node/v7.8.0/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/Users/shenghu/.nvm/versions/node/v7.8.0/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/Users/shenghu/.nvm/versions/node/v7.8.0/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/Users/shenghu/.nvm/versions/node/v7.8.0/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/Users/shenghu/.nvm/versions/node/v7.8.0/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/Users/shenghu/.nvm/versions/node/v7.8.0/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/Users/shenghu/.nvm/versions/node/v7.8.0/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)

Is there anything I missing?

Cannot read property 'length' of undefined. api_blueprint to swagger_2

Im getting the following error while trying to convert from api_blueprint to swagger_2
Fatal TypeError: Cannot read property 'length' of undefined at jsonSchemaFromMSON (/usr/local/lib/node_modules/api-spec-converter/node_modules/apib2swagger/index.js:217:37) at /usr/local/lib/node_modules/api-spec-converter/node_modules/apib2swagger/index.js:38:67 at Array.forEach (<anonymous>) at /usr/local/lib/node_modules/api-spec-converter/node_modules/apib2swagger/index.js:31:26 at Array.forEach (<anonymous>) at Object.module.exports.convertParsed (/usr/local/lib/node_modules/api-spec-converter/node_modules/apib2swagger/index.js:28:8) at converters.swagger_2.Promise.method.apibp (/usr/local/lib/node_modules/api-spec-converter/lib/formats/api_blueprint.js:16:24) at tryCatcher (/usr/local/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/util.js:16:23) at /usr/local/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/method.js:15:34 at Promise.try (/usr/local/lib/node_modules/api-spec-converter/lib/base_format.js:162:12) at tryCatcher (/usr/local/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/util.js:16:23) at Function.Promise.attempt.Promise.try (/usr/local/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/method.js:39:29) at module.exports.BaseFormat.convertTo (/usr/local/lib/node_modules/api-spec-converter/lib/base_format.js:154:21) at Converter.getSpec.then.fromSpec (/usr/local/lib/node_modules/api-spec-converter/index.js:33:32) at tryCatcher (/usr/local/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/api-spec-converter/node_modules/bluebird/js/release/promise.js:512:31)

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.