-
Notifications
You must be signed in to change notification settings - Fork 240
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
Fix return types for backend resource deletions #3833
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 8716f30 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @kylekz and sorry for the late response and thank you very much for the contribution but i am afraid that it will require some work in order to be merged.
Since you took the time to contribute i will try to provide some context for the rest of the required changes.
The API methods of our backend SDK are expected to return a *Resource
type. The request<T>
method used is expected to be passed a *Resource
type which will be the returned type of the API method.
Based on the above instead of using the this.request<DeletedObjectJSON<typeof ObjectType.*>>
we should be using the this.request<DeletedObject<typeof ObjectType.SamlAccount>>
Finally the saml_account
and saml_connection
are different resources. As you have noticed the ObjectType.SamlConnection
is missing from our codebase so we need to add it 😅
@dimkl no problem, thanks for the response! I've updated to add I don't want to be wasting dev time with reviews etc so I'm off the mark here then I'm cool with closing and just opening an issue :) |
Description
When deleting resources, for example an Organization, the backend client is typed to return
Organization
, whereas the actual HTTP API returns aDeletedObject
, resulting in a type mismatch. This PR:DeletedObjectJSON
to accept a generic that extendsstring
, with a default ofstring
ObjectType
but then that would breakDeletedObject.fromJSON()
this.request()
for the following resource delete methods:Allowlist
Domain
EmailAddress
Organization
PhoneNumber
RedirectUrl
SamlConnection
ObjectType.SamlAccount
is the correct type, as there's noSamlConnection
User
I'm not sure what the convention would be for handling this
DeletedObjectJSON
type
property so this just seemed like the most straight forward way that wouldn't break anything 😅Checklist
npm test
runs as expected.npm run build
runs as expected.Type of change