-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JavaScript Module - LoginRequest doesn't seem to work #2892
Comments
@cwbuecheler please share the spec so that we can help look into the issue |
@wing328 Thanks for the quick response. Happy to share whatever you need. Here's the raw swagger.json spec. If you need anything else, let me know. Thanks! |
@cwbuecheler the model definition looks good to me:
and I believe the backend is expecting something like the following:
How did you generate the JS API client? |
Yep, that's exactly what the back-end is expecting. I generated it with swagger-codegen on OSX, installed via homebrew, with the Java 8 SDK and Maven installed, using the following command:
where api.url is the ... url to our api :) I then moved the entirety of swagger output to our project, changed the default URI from localhost to our API URI, and I'd be happy to send the entire swaggeroutput dir (minus its node_modules folder) if you'd like. Or if I screwed up something in the initial generation syntax, please let me know. Thanks! |
We do have a test case for JS API client to cover post model (JSON): https://github.com/swagger-api/swagger-codegen/blob/master/samples/client/petstore/javascript/test/api/PetApiTest.js#L58 |
I also suspect you're not using the latest version/master. I would suggest you to pull the latest and build the jar locally. Here is a good starting point: https://github.com/swagger-api/swagger-codegen#getting-started |
OK, thanks, I'll skip homebrew and build manually (I've not worked with Java before so I figured I'd take the easy road first). Will also run some tests and see if they come up with any issues. |
@wing328 - I've snagged the lastest master from github, built the jar locally and installed it as a node module, but am running into issues with webpack that I don't fully understand. Basically it won't load any of the factories listed at the top of
I've looked into adjusting my webpack config but it should be working -- I can and do import plenty of other node modules into my React app, most of which use the I understand this may be a webpack issue (or more likely, a problem with my config) and is therefor kind of outside of the scope of what you may be able to provide support on, but I figured I'd check and see if you had any thoughts. |
@cwbuecheler sorry I've no idea either. I've marked this as "Need community contribution" for the time being to see if anyone from the community has a clue. |
@cwbuecheler did you find a solution? Would you share the solution and/or the directory structure generated? I have a similar issue, and it feels like a path problem. |
Honestly, I switched to swagger-client and stopped using swagger-codegen after encountering this issue, so I'm afraid I don't have an answer. |
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)
If I skip using the
LoginRequest()
method and just do the following, it works:I've looked through the docs, I've tried using
JSON.stringify()
on the data I'm passing toLoginRequest()
, and even tried to do some testing onLoginRequest.js
but haven't been able to figure out what the problem is. Any ideas?The text was updated successfully, but these errors were encountered: