-
Notifications
You must be signed in to change notification settings - Fork 16
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
SwaggerGen for server/client integration #830
Comments
Hey @murugaratham, s'been a while! There are a few openapi generators that I generally prefer, mostly operating off jsdoc. I would also need to have a think about how to drop a generated API client into the dev process too. In the meantime, you may want to file a similar issue at opengovsg/ts-template, since they probably are in a better place to introduce this. |
As agreed with @murugaratham, this issue may be more relevant for ts-template, since they are better placed to put in good practice |
hey @LoneRifle, i've decided to pop by and see where i can help :) agree that amongst all the open-api generator flavours available, it would require good decision making and thoughts. Leave that in your good hands, maybe to simplify it further since you're "templatizing" it, (i wasn't aware that you guys have templates, great work!), you can consider bootstrap the client generation at "prestart" lifecycle as documented here |
Is your feature request related to a problem? Please describe.
I'm always frustrated when backend developers implement new API or make changes and frontend would have to hand-code (error-prone or frustrated sometimes) route changes, parameter changes, verb changes etc.. etc..
Though being a fullstack developer (my assumption) usually make both frontend & backend changes in the same PR, but when i make changes on APIs, i would still welcome codegen, as it saves time.
Describe the solution you'd like
Implement swagger generation for express backend, and on frontend, install openapi-generator as dev-dependencies and add the following to scripts:
you can even decide to host swagger.json on SIT servers rather than local, depending on your dev workflow
depending on your linter prefs, i do npx replace-in-file as the default
typescript-axios
generators doesn't work nicely with my eslint rules.Describe alternatives you've considered
Writing api integration codes through hand.
Additional context
Just quality of life improvement, but once i've implemented that for some of my projects, i've never looked back.
Example of generated clients
Example of consumption of API
Make this configurable in some common/util.ts file...
export const identityApi = new IdentityApi(undefined, window._env_.REACT_APP_IDENTITY_SERVER_URL);
The text was updated successfully, but these errors were encountered: