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

feat: add automatic client SDK generation #405

Merged
merged 13 commits into from
Feb 15, 2024

Conversation

eric-nguyen-cs
Copy link
Contributor

What

  • Add an automatic client SDK generator: it uses the fact that we are able to export an OpenAPI spec from FastAPI and that this spec is able to be parsed into a Typescript client

The goal is in the future to incrementally add Pydantic Models as return types to the path functions to serve as output validators and as documentation for the OpenAPI spec.
Thus, adding a new API call on the frontend should now involves:

  • adding a Pydantic model to the return type of the API call
  • using the client SDK to call the RPC instead of manually calling the API using fetch or axios. The API return types should also be imported from the SDK

Copy link
Contributor

@perierc perierc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work, I approve! I have a question though

Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really want to put it in the git ?

Why not generate it with fastapi instead ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Well I found it was easier to implement this way (and it may also facilitate the debugging of the SDK generation)
If you want I can have a look at how to do the FastAPI server but I feel that it may be a bit complex (namely what happens if the server is already running)

@eric-nguyen-cs eric-nguyen-cs merged commit 7751319 into main Feb 15, 2024
7 checks passed
@eric-nguyen-cs eric-nguyen-cs deleted the ericn/add-automatic-client-sdk-generation branch February 15, 2024 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: No status
Development

Successfully merging this pull request may close these issues.

3 participants