openmrs.js swagger-client issue

Hi @willa,

I found the issue https://github.com/swagger-api/swagger-js/issues/892 you posted and am running into the same thing when playing with https://github.com/psbrandt/openmrs.js

Have you found a solution? Should the swagger-client dependency be updated?

thanks!

1 Like

@willa did you miss out on this? :blush:

1 Like

I certainly missed this one. No @teleivo, I did not find the solution and because we had far more pressing issues I stopped looking.

1 Like

I’ve managed to recreate the issues using the following code:

$ npm install openmrs.js
$ node
> OpenMRS = require('openmrs.js')
> o = new OpenMRS()
> o.login('admin', 'Admin123', 'https://demo.openmrs.org/openmrs')
{ state: 'pending' }
> TypeError: Cannot create property 'vendorExtensions' on string 'basic'
    at SwaggerClient.buildFromSpec (/Users/pascal/to/node_modules/swagger-client/lib/client.js:309:43)
    at Resolver.finish (/Users/pascal/to/node_modules/swagger-client/lib/resolver.js:510:14)
    at /Users/pascal/to/node_modules/swagger-client/lib/resolver.js:329:16
    at Resolver.resolve (/Users/pascal/to/node_modules/swagger-client/lib/resolver.js:413:6)
    at Resolver.finish (/Users/pascal/to/node_modules/swagger-client/lib/resolver.js:514:10)
    at /Users/pascal/to/node_modules/swagger-client/lib/resolver.js:329:16
    at Resolver.resolve (/Users/pascal/to/node_modules/swagger-client/lib/resolver.js:413:6)
    at Resolver.finish (/Users/pascal/to/node_modules/swagger-client/lib/resolver.js:514:10)
    at /Users/pascal/to/node_modules/swagger-client/lib/resolver.js:329:16
    at Resolver.resolve (/Users/pascal/to/node_modules/swagger-client/lib/resolver.js:413:6)

When I install openmrs.js, the latest version of the Swagger client gets installed though, so I don’t think that’s the problem. I’ve created the following ticket to track work on this:

1 Like

The actual issue here is that we are not conforming to the OpenAPI spec. See RESTWS-650 for more details.

PR here:

1 Like

That was fast! Thanks @pascal :smile: