swagger-api / swagger-api/swagger-codegen
[Javascript] Codegen client for Swagger 2.0 using API Key authentication doesn't expose a way to actually set the API Key, generated example is wrong
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Generated a Javascript client from this API spec:
https://api.cloudmersive.com/barcode/docs/v1/swagger
Thus creating an NPM here:
https://www.npmjs.com/package/cloudmersive-barcodeapi-client
Expected: The example code shows a way to set the Apikey
Observed: Example code does not show how to set the Apikey. Not clear how to actually set the Apikey
Swagger-codegen version
2.3.1
Swagger declaration file content or url
https://api.cloudmersive.com/barcode/docs/v1/swagger
Command line used for generation
java -jar swagger-codegen-cli.jar generate -i https://api.cloudmersive.com/barcode/docs/v1/swagger -l javascript -o .\Cloudmersive.APIClient.NodeJS\barcode --api-package cloudmersive-barcode-api-client
Steps to reproduce
Follow above steps. Note that the code example provided does NOT include a way to set the Apikey:
var Barcodeapi = require('barcodeapi');
var api = new Barcodeapi.BarcodeLookupApi()
var value = "value_example"; // {String} Barcode value
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.barcodeLookupEanLookup(value, callback);
Related issues/PRs
Suggest a fix/enhancement
Show how to set the Apikey in the code example! Also, there are no docs in swagger-codegen that say how to actually do this either
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the generation with swagger-codegen-cli.jar 2.3.1, the Swagger declaration URL, and the javascript command shown in the issue. Inspect the generated BarcodeLookupApi example and compare it with the API key authentication required by the specification. Done means the example and Swagger-codegen documentation clearly show how to set the API key.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100