django-react-boilerplate icon indicating copy to clipboard operation
django-react-boilerplate copied to clipboard

Set up client API code generation

Open pamella opened this issue 9 months ago • 6 comments

Description

We will use the openapi-ts tool to generate TypeScript client code for the frontend based on the backend schema generated by DRF-Spectacular.

Motivation and Context

Screenshots (if appropriate):

Screencast from 14-05-2024 17:39:51.webm

Steps to reproduce (if appropriate):

  • The project should be running properly.
    • With docker
    • Without docker
    • Deployed (e.g.: Render)
  • The API documentation pages should be working properly.

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [X] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [X] My code follows the code style of this project.
  • [X] My change requires documentation updates.
  • [X] I have updated the documentation accordingly.
  • [X] My change requires dependencies updates.
  • [X] I have updated the dependencies accordingly.

pamella avatar May 14 '24 20:05 pamella

Note: the security/snyk step is failing due to an Uncontrolled resource consumption issue on https://github.com/micromatch/braces. The issue was reported yesterday and there isn't a patch yet.

pamella avatar May 14 '24 21:05 pamella

Overall LGTM, but can we add client generation to pre-commit?

I already added it to pre-commit. See: image

The frontend client generation script is triggered whenever the backend schema changes.

pamella avatar May 15 '24 13:05 pamella

Nice @pamella , then all we need to merge here is passing snyk and explaining the pre-commit client generation on README.

fjsj avatar May 15 '24 13:05 fjsj

I've made the fixes. I guess we will just have to wait for braces to fix the vulnerability now. Hopefully, the will merge the in-progress PR soon :crossed_fingers:

pamella avatar May 15 '24 14:05 pamella

I think we need to remove redux mentions from README. @pamella

fjsj avatar May 15 '24 15:05 fjsj

I think we need to remove redux mentions from README. @pamella

Sorry, I missed it. Done (commit 37d8ba0)

pamella avatar May 15 '24 15:05 pamella