swagger-api / swagger-api/swagger-codegen
JavaScript Module - LoginRequest doesn't seem to work
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Greets,
I used swagger-codegen to generate a node module that I could then reference in my React project. This worked fine and I have it up and running, however the LoginRequest method doesn't appear to be working right. I just want to make sure I have the syntax correct. The following code always sends an empty body to the server, resulting in a 500 error. Is there something wrong with it?
(note: the auth info is obviously fake, but even with fake creds it should return a 401, not a 500 -- with the real creds, it's still a 500 because they're never being sent)
import SwaggerJsClient from 'swagger-js-client';
const api = new SwaggerJsClient.DefaultApi()
const opts = {
'body': new SwaggerJsClient.LoginRequest({ email: 'test@test.com', password: 'testme' }),
};
const callback = (error, data, response) => {
console.log('error: ', error);
console.log('data: ', data);
console.log('response: ', response);
};
api.login(opts, callback);
If I skip using the LoginRequest() method and just do the following, it works:
const opts = {
'body': {
'email': 'test@test.com',
'password': 'testme',
},
};
I've looked through the docs, I've tried using JSON.stringify() on the data I'm passing to LoginRequest(), and even tried to do some testing on LoginRequest.js but haven't been able to figure out what the problem is. Any ideas?
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 generated Node module from the reported example and inspect LoginRequest.js, comparing it with the working plain-object body. Confirm the request serialization includes the email and password fields and verify the resulting server response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100