Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Convert REST response type to tagged union #115

Closed
ecxyzzy opened this issue Dec 4, 2023 · 0 comments · Fixed by #134
Closed

Convert REST response type to tagged union #115

ecxyzzy opened this issue Dec 4, 2023 · 0 comments · Fixed by #134
Assignees
Labels
area: rest-api Related to the REST API specifically priority: low Low priority issue story point: 1 Quick copy change type: chore All other necessary (but less impactful) tasks
Milestone

Comments

@ecxyzzy
Copy link
Member

ecxyzzy commented Dec 4, 2023

Currently, to determine whether a RawResponse<T> is a Response<T> or an ErrorResponse, we test whether the payload field exists. This is kind of cumbersome and is why we ship an isErrorResponse function with the types package, but we could just add success: true to the former variant of RawResponse<T> and success: false to the latter.

This would make error checking as simple as testing res.success, and would also allow consumers of the types package to only add it as a devDependency (not sure if the latter matters as much though).

@ecxyzzy ecxyzzy added priority: low Low priority issue story point: 1 Quick copy change type: chore All other necessary (but less impactful) tasks area: rest-api Related to the REST API specifically labels Dec 4, 2023
@y-dejong y-dejong self-assigned this Jan 18, 2024
@jordany33 jordany33 self-assigned this Jan 18, 2024
@ecxyzzy ecxyzzy moved this from Backlog to In Progress in PeterPortal API :: Next Jan 31, 2024
@ecxyzzy ecxyzzy added this to the 1.0 milestone Feb 29, 2024
@ecxyzzy ecxyzzy linked a pull request Mar 9, 2024 that will close this issue
@github-project-automation github-project-automation bot moved this from In Progress to Done in PeterPortal API :: Next Apr 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: rest-api Related to the REST API specifically priority: low Low priority issue story point: 1 Quick copy change type: chore All other necessary (but less impactful) tasks
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants