Use swagger-generated client in Vue project

I’m trying to use my swagger-generated client in my Vue components. It’s located in swagger/api. I’ve run these commands in the swagger client package:

npm install
npm link

Then I ran this in my root vue project directory:

npm link swagger/api

Then I include it in my component like this:

 var mySwagger = require('swagger_api');

And I get this error:

This dependency was not found:

I do see my swagger client package listed in packages.json, and I see it in node_modules. Does anyone know what’s wrong? Or is there a better way to use a swagger-generated client with a Vue project? I’ve had a hard time finding any examples. Thanks!

Hi @w00kie did you ever happen to overcome this issue? I’m also facing this error while importing installed client to the vue component.

I was using git repository url for the installation though.

So I removed my yarn.lock, removed node_modules, and then ran yarn install again and I believe it worked for me after that.

Hi w00kie,

Which tool did you use for the client generation?

I would like to generate some code too, but I don’t get it working in vue. I tried https://openapi-generator.tech/ and use the javascript generator. This generates correct api calles but I am not happy with the generated model classes.