Skip to content
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

Build a JS client library #2336

Closed
glederrey opened this issue Mar 8, 2016 · 13 comments
Closed

Build a JS client library #2336

glederrey opened this issue Mar 8, 2016 · 13 comments

Comments

@glederrey
Copy link
Contributor

Hi,

This isn't really an issue.. But I'm trying to use the JS client library and trying to build a really simple wrapper to use it.. But I really can't.. I've been struggling for days on this..

Does anyone have an example a bit simpler than the one you provide? Or could you show a way to call a function without any parameters? I can share my JSON spec.

Thank you very much

@wing328
Copy link
Contributor

wing328 commented Mar 9, 2016

@glederrey first of all, please use the latest master to generate the JS API client if you've not done so as there's been a lot of enhancements to the JS API client generator recently.

Here are some test cases: https://github.com/swagger-api/swagger-codegen/blob/master/samples/client/petstore/javascript/test/api/PetApiTest.js

Would these serve as a good starting point?

@wing328 wing328 added this to the v2.1.6 milestone Mar 9, 2016
@glederrey
Copy link
Contributor Author

@wing328 I used the latest master to generate it.. And I also tried to start from this JS script.. I could make it work.. But I wasn't able to use it in another way for my purpose..

I won't lie to you, I just started JS.. So, I don't understand everything.. But also, I think your example is a bit complex to understand for someone who never used JS..

I will continue when I have the time to do it.. And if I can find a simpler example, I will show it to you.. So, that you can maybe have this complexe and complete example with Mocha and a simpler one just to understand how to use the JS client library.. Is it fine?

@wing328
Copy link
Contributor

wing328 commented Mar 9, 2016

@glederrey how urgent do you need the example?

We're working on a task to improve the documentation for the JS API client.

For your reference, here is the sample documentation we've generated for Perl Petstore: https://github.com/wing328/swagger-petstore-perl/blob/master/docs/PetApi.md

Later we'll need your feedback from a JS beginner developer perspective to review the documentation for JS API client.

@glederrey
Copy link
Contributor Author

@wing328 It's not urgent.. Since our calls are really simple (for one of our API) we're using simple requests with jQuery and ajax.. But we want to have multiple client libraries for a more complex API.. I don't think we'll need this until end of March.. If my boss asks me for it, I'll come back to you.

And what you've done is really cool and really intuitive. I like it! It would be perfect to have it for all the languages.. =)

And I'll be happy to help you. Do not hesitate to ask.

Thanks for the good work.

@wing328
Copy link
Contributor

wing328 commented Mar 16, 2016

@glederrey Here is what the documentation (markdown) looks like: https://github.com/xhh/swagger-petstore-js

@glederrey
Copy link
Contributor Author

@wing328
Hi,

It's looking good.. =) Just a question, this documentation is the one for the JS client library, right??
If you want me to do a review for you and write down some comments, I can do it..

@wing328
Copy link
Contributor

wing328 commented Mar 16, 2016

Yes, it's the JS API client for Petstore. If you (or anyone from the community) has any feedback on the auto-generated documentation (markdown), please let us know.

@glederrey
Copy link
Contributor Author

Okay.. I will take your link and check if I have some comments to do.. Do I write them here?? Just tell me the more convenient way for you..

@wing328
Copy link
Contributor

wing328 commented Mar 16, 2016

Sharing here is fine.

@wing328
Copy link
Contributor

wing328 commented Mar 16, 2016

or you can send me directly via my personal email address in my Github profile page if you prefer to keep your feedback private.

@glederrey
Copy link
Contributor Author

I will send it here.. So that if someone want to confirm or change of my comments, he/she can discuss about it here too..

I'll do that for Friday.

@glederrey
Copy link
Contributor Author

Hi @wing328,

I don't have a lot of comments to do on the JS doc.. It's really well done!

The only thing that is a bit confusing for me is the first line of code in the Getting Started section: var SwaggerPetstore = require('swagger-petstore');. This swagger-petstore comes after we've done the installation step using npm, right?? If you can be a bit more clear on this, it would be perfect.. (Just a line of comment should be enough)

On Tuesday, one of our interns will start writing the JS client library for our API.. I'll give him this documentation and I'll ask him to write here if he has some improvements to do.

Thanks for the good work again.. =)

@wing328
Copy link
Contributor

wing328 commented Apr 9, 2016

@glederrey thanks for the feedback. I'll add a one-liner later in v2.2.0

@wing328 wing328 closed this as completed Apr 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants