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

Usage & scaling considerations? #1287

Closed
john-goldsmith opened this issue Apr 16, 2018 · 2 comments
Closed

Usage & scaling considerations? #1287

john-goldsmith opened this issue Apr 16, 2018 · 2 comments

Comments

@john-goldsmith
Copy link

I'm trying to weigh the pros and cons of swagger-js and swagger-codegen, and my biggest question about the former as I understand it is: is requesting an entire JSON spec a viable solution as my API grows? Is swagger-js intended to be used on the client (using its Swagger(url).then(client) form) or more as a component in a CI/CD pipeline (or both, or neither)?

For context, I have a React app (via create-react-app, non-ejected) and I'd like to include a programmatic Promise-based interface (SDK) to my backing API (which it seems swagger-codegen has issues with). Generally I like to avoid burdening end-users with unneeded network requests, especially if they're of substantial size like it seems a Swagger spec is. Any advice on this topic is appreciated. Thanks!

@shockey
Copy link
Contributor

shockey commented May 15, 2018

Hi @john-goldsmith!

is requesting an entire JSON spec a viable solution as my API grows?

Generally I like to avoid burdening end-users with unneeded network requests, especially if they're of substantial size like it seems a Swagger spec is.

That is something that only you can answer. Are your users going to be mostly on 3G mobile devices, or on fiber-to-the-premises connections in major cities? 😄

Also be aware of the fact that your swagger.json will change rather infrequently, on average, so you can take advantage of aggressive caching so that your users won't need to download it again and again. You can also use the Client in such a way that your swagger.json isn't fetched until the user intends to do something that involves your API.

Is swagger-js intended to be used on the client

Yes, it is!

@john-goldsmith
Copy link
Author

Interesting, thanks for the info.

Also be aware of the fact that your swagger.json will change rather infrequently

Although this might be true for some projects that are considered "stable", this is assumption is definitely not a fact.

use the Client in such a way that your swagger.json isn't fetched until the user intends to do something that involves your API

Absolutely, but in the context of a SPA, chances are high that it will be needed almost immediately.

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