frontend
frontend copied to clipboard
Auto-generate TypeScript client with types from backend's documented Swagger API
Description
Using https://github.com/acacode/swagger-typescript-api, a TypeScript-based client with types is generated from the cadet backend's swagger.json
.
TODO:
- [ ] Add documentation
- Basic instructions
- Copy
swagger.json
tosrc/commons/api/
- Run
yarn run update-cadet-api
- Copy
- Basic instructions
- [ ] Avoid typecasting
- [ ] Ensure generated types are accurate
- [ ] Switch from
fetch
to the new API globally
Type of change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [X] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update
- [X] Code quality improvements
How to test
Run the test suite.
Checklist
- [ ] I have tested this code
- [ ] I have updated the documentation
Deploying with
Cloudflare Pages
Latest commit: |
94db8bd
|
Status: | ✅ Deploy successful! |
Preview URL: | https://db7968c8.cadet-frontend.pages.dev |
Yes, yes, so much yes. This is probably the best thing that's happened in the frontend code-quality wise ever since it was written. Looking forward to seeing this merged :)
Hmm, anyone looking after this PR? @bnjmnt4n ? There is enthusiastic support from @angelsl . But still in draft and currently with merge conflict...
Sorry for the delays. I was planning to come back to it, and will take a look at it hopefully this weekend.
Reviewing our open PRs and this one comes up again. @bnjmnt4n do you have time these days? There is/was enthusiastic support from @angelsl . But still in draft and currently with merge conflict...
This will need quite a bit of time to properly convert all the places in the frontend that make requests to the backend. And we need to make sure the backend Swagger definitions are accurate as well (unfortunately Elixir is dynamically typed so it's not possible to generate Swagger definitions from type information...)
It'll be tedious but worth it.