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

How to create static javascript api #78

Closed
razakpm opened this issue Jul 30, 2013 · 8 comments
Closed

How to create static javascript api #78

razakpm opened this issue Jul 30, 2013 · 8 comments

Comments

@razakpm
Copy link

razakpm commented Jul 30, 2013

Hi,
We like to create static javascript api using swagger. We tried with node.js implementation but we didn't succeeded in the browser.
I need something like ./bin/runscala.sh com.wordnik.swagger.codegen.BasicJSGenerator http://petstore.swagger.wordnik.com/api/resources.json

I know a runtime support for javascript is there , but I prefer a static api geneartion.
Any advice is very helpful.

@fehguy
Copy link
Contributor

fehguy commented Jul 30, 2013

Hi, currently there is no static javascript generator, but you could certainly create one. I'll leave this open as a feature, but sorry, there isn't a generator right now.

@fehguy
Copy link
Contributor

fehguy commented Dec 24, 2014

will address in the 2.1.0-M2 milestone

@fehguy fehguy closed this as completed Dec 24, 2014
@jdhiro
Copy link

jdhiro commented Aug 28, 2015

It looks like this probably fell out of scope at some point. My team would really love to see this working (as well as an Angular $resource based generator).

@mozey
Copy link

mozey commented Aug 30, 2015

@jdhiro I wrote something to do this a while back. But it's a bit intertwined in other code and I never bothered to extract it. Also, I just used the $http service directly, not $resource. Recently been wondering if swagger-codgen supports static javascript yet and come across this link, have you tried it? https://github.com/wcandillon/swagger-js-codegen

@who
Copy link
Contributor

who commented Aug 30, 2015

I've written an npm package that can accomplish the original intent of this ticket:

https://www.npmjs.com/package/swagger-client-standalone

This package builds all of the NPM dependencies, the swagger spec, and swagger client all into one JS file. I use it in places where I can only use UMD-style includes. Because modular javascript doesn't work well in UMD environments, I opted to bundle it together.

@jdhiro
Copy link

jdhiro commented Aug 31, 2015

@mozey I haven't tried that project yet, but I was going to. They don't support $resource yet either.

@who Yeah, I'm making a library/SDK, so I'm basically just doing a require('swagger.json') and bundling it all up. This really just makes the runtime library superfluous though.

@jdhiro
Copy link

jdhiro commented Aug 31, 2015

Good lord, I just realized that this approach is adding over 300kb to my library. That is not an option.

@wing328
Copy link
Contributor

wing328 commented Dec 7, 2015

@jfiala has created a JS API client generator, which has been merged into master. Please pull the latest master and give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants