Hi, has anyone tried this documentation Load Testing Your API with Swagger/OpenAPI and k6?
I have gone through all these links without success:
https://openapi-generator.tech/
https://openapi-generator.tech/docs/installation/
https://github.com/loadimpact/openapi-generator
https://github.com/loadimpact/openapi-generator/blob/master/docs/migration-from-swagger-codegen.md
https://github.com/openapitools/openapi-generator-cli
My installed versions are:
java version “13.0.1” 2019-10-15
Java™ SE Runtime Environment (build 13.0.1+9)
Java HotSpot™ 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)
I have installed npm package wrapper for OpenAPI Generator too:
$ openapi-generator version
4.3.0
Anyone able to help me with
- more detailed steps of how to setup everything to use this generator?
- how to properly use the command which I think it is openapi-generator
Thank you
Hi @nifepo,
I have written this guide and the extension and I am quite sure it works.
Since I didn’t want to bother users with the task of installing JRE as part of this guide, I have used Docker, which already has all the needed components, for the converter to work. If you want to run the converter using JRE, have a look at this section of its original README docs: 1.3 - Download JAR.
The npm package wrapper is also not needed if you use either the Docker image or the JAR file, and I have no idea why you installed that.
Just let me know here, if you want to know more or if I can help you with specifics.
P.S. I think you’ve copied the links from Slack, thus they don’t redirect correctly.
Hi @mostafa
I apologize if my opening question didn’t sound well and offended you, It wasn’t my intention.
I have choosed to try to get used to docker.
Everything is installed, docker version works and Hello World too, I created an account as well (docker).
I ran **docker pull openapitools/openapi-generator-cli**
and it ended correctly. I was expecting to see some sort of dashboard with pulled projects or images or , but couldn’t see it listed. This is surely becasue of myself being new to docker I assume.
Despite of that, I ran:
$ docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate
-i http://httpbin.test.loadimpact.com/spec.json
-g k6
-o /local/k6-test/
–skip-validate-spec
Got an access denied error to my local drive and I solved it with https://docs.microsoft.com/en-us/archive/blogs/stevelasker/configuring-docker-for-windows-volumes
Tried to ran same command again and now the error is:
C:\Program Files\Docker\Docker\resources\bin\docker.exe: Error response from daemon: open \\.\pipe\docker_engine_linux: The system cannot find the file specified.
It seems to be related to my docker configuration, i’m working on a solution.
Thanks for your feedback and help.
Hey again! 
Since you’re having issues mounting volumes (folders on your local machine) to Docker, which is a known issue on Docker, I suggest you to use the JAR file instead, which I’ve mentioned above.
Hi, I was able to solve it.
- update command to be run on one single line only:
docker run --rm -v \c\tests:/local openapitools/openapi-generator-cli generate -i http://httpbin.test.loadimpact.com/spec.json -g k6 -o /local/k6-test/ --skip-validate-spec
- We stop using C:/Users/xxxx drive to avoid all kind of different permission issues and used a new folder at C level instead. (didn’t create a new drive yet)
So we changed ${PWD}:/local to \c\tests:/local <---- “tests” is our new folder.
- We unchecked Read Only from this created folder and save changes.
Command was ran successfully, folder and files were created as well.
Thank you for your help and patience, have a great day !
Regards
1 Like
Hi @nifepo,
I am really glad to see your case solved.
Good luck exploring! 