fix(rest): return what the endpoints actually answer with - #18
Merged
Merged
Conversation
GuildScheduledEvent::get(), create() and modify() mapped their answer as an array. Discord answers each with one event, and mapArray() declares its parameter as array, so every call died on a TypeError before it returned anything. There was no test file for the class at all, which is how three of its six methods came to have never worked. Eleven more methods had a @return that disagreed with the mapper beside it — getBan and four Webhook methods documented as lists while returning one object, and getVoiceRegions, getInvites, getIntegrations, getChannelInvites, GuildTemplate::list and the two role connection metadata methods documented as one while returning lists. Nothing broke at runtime, but every caller's static analysis was told the wrong shape, which is how this was noticed: a bot reading getBan()->reason was told it was reading a property on an array.
github-actions Bot
pushed a commit
that referenced
this pull request
Sep 2, 2026
## [1.3.4](v1.3.3...v1.3.4) (2026-09-02) ### Bug Fixes * **rest:** return what the endpoints actually answer with ([#18](#18)) ([77e56e0](77e56e0))
|
🎉 This PR is included in version 1.3.4 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two problems, found by auditing every
@return PromiseInterface<...>against the mapper used beside it.Three methods that have never worked
GuildScheduledEvent::get(),create()andmodify()callmapArrayPromise(). Discord answers each of them with one event, andDataMapper::mapArray()declares its parameter asarray— so astdClassreaches it and the call dies on aTypeErrorbefore returning anything.There was no test file for the class at all, which is how three of its six methods came to have never worked. There is one now, covering all six.
This is the third instance of exactly this bug in this repo (
createChannel, the archived-thread listings, now these), and each time the tell was the same: an untested method withmapArrayPromiseon a singular endpoint.Eleven annotations that disagreed with the code
Nothing breaks at runtime, but every consumer's static analysis is told the wrong shape — which is how this was noticed. A bot reading
getBan()->reasonwas told it was accessing a property onarray<GuildBan>:Guild::getBanGuild::getVoiceRegionsWebhook::getGuild::getInvitesWebhook::getWithTokenGuild::getIntegrationsWebhook::modifyChannel::getChannelInvitesWebhook::modifyWithTokenGuildTemplate::listApplicationRoleConnectionMetadata::getRecordsApplicationRoleConnectionMetadata::updateRecordsFound while building a ban-appeal flow that reads a ban's reason back off
getBan().🤖 Generated with Claude Code