wcandillon / swagger-js-codegen

A Swagger Codegen for typescript, nodejs & angularjs
Apache License 2.0
693 stars 286 forks source link

Client side library with browserify / wepback with superagent #65

Closed hekike closed 8 years ago

hekike commented 9 years ago

I've been working on a branch to transform swagger-js-codegen from request to superagent because superagent is able to run on both client and server sides. This would make it possible to bundle the output code with browserify/wepback and provide a client library as well.

Is it something what you find interesting? Should i continue the work?

Progress: https://github.com/hekike/swagger-js-codegen/commits/feature/superagent

wcandillon commented 9 years ago

@hekike I think it would be interesting to have only a single template for both browser and nodejs javascript.

indolering commented 9 years ago

@hekike Any progress on this? Does your fork pass all of the tests?

indolering commented 9 years ago

For me, there are two primary reasons for wanting to pre-generate the library: static builds for deployment and enabling the IDE to pickup on available commands. Browserify tends to bloat the size of the package and it confuses IDEs.

A better strategy would be to switch to the upcoming Fetch API or Popsicle and use native promises. All three have libraries/polyfill for Node and the major browsers.

As a convenience for browser users, we could add a third template that inlines the Fetch/Popsicle and promise polyfills.

hekike commented 9 years ago

@wcandillon no, unfortunately I also started to do a heavy refactor and added some features what we needed asap at our company.

The good news is that we are using the generated code for months, in production as well. The bad news is that I still need time to fix all of the tests.

what I added or changed:

dciccale commented 8 years ago

+1 for bluebird and superagent.

I am using bluebird in my fork as well.

bluebird is very powerful, for example it allows to catch multiple predicate errors. Which is super handy.

It also has a compliant API. It have also deprecated "deferred's" in favor of spec compliant syntax. and some other cool stuff

wcandillon commented 8 years ago

@hekike @indolering @dciccale I started a PR for this: #104 .