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

670 use typed responses for api calls #858

Draft
wants to merge 13 commits into
base: devel
Choose a base branch
from

Conversation

zmjohnso
Copy link
Contributor

@zmjohnso zmjohnso commented Oct 10, 2024

The goal of this PR is to begin addressing issue #670. As an example, I added a typed API response to getWalletAll. As the issue states, this should improve the developer experience by moving the body parsing into a single location and give some type completion when making this call in the future. If this still seems like a good direction to go in, I will start working on adding typed responses for the rest of the calls in JmWalletApi.ts.

@theborakompanioni
Copy link
Collaborator

Hey @zmjohnso! Like the direction this is going.
Hope I have time to think about it a bit and provide feedback.

e.g. what do you think about generating the schema with npx openapi-typescript https://joinmarket-org.github.io/joinmarket-clientserver/api/wallet-rpc.yaml -o ./src/libs/JmWalletApi.d.ts?

@theborakompanioni theborakompanioni added tech dept Removes some technical debt refactoring Code refactoring without functional changes RPC-API A feature or functionality that aims to modify Joinmarket api's labels Oct 14, 2024
@zmjohnso
Copy link
Contributor Author

Hey @zmjohnso! Like the direction this is going. Hope I have time to think about it a bit and provide feedback.

e.g. what do you think about generating the schema with npx openapi-typescript https://joinmarket-org.github.io/joinmarket-clientserver/api/wallet-rpc.yaml -o ./src/libs/JmWalletApi.d.ts?

Oh, yes; thanks for sharing that! I think generating the types is usually better and should also save some time. I added the types in and I'm working on updating some more endpoints. I'll push some more code in the next few for you to take a peak.

@zmjohnso zmjohnso marked this pull request as draft October 16, 2024 00:38
@theborakompanioni
Copy link
Collaborator

@zmjohnso How do you want to proceed? Should we include the generated files here before publishing it as a standalone lib for others to use as well?

@zmjohnso
Copy link
Contributor Author

@theborakompanioni Yes, I think just including the generated file here would be the easiest way to get the most value for Jam. But publishing a standalone lib is a neat idea; something that can be worked on in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Code refactoring without functional changes RPC-API A feature or functionality that aims to modify Joinmarket api's tech dept Removes some technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants