Add redirect uri list to dev app response#740
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the developer app retrieval query to include the list of registered OAuth redirect URIs in the developer app response payload.
Changes:
- Extend
GetDeveloperAppsSQL to LEFT JOINoauth_redirect_urisand aggregateredirect_urisper app. - Regenerate sqlc output to add
RedirectUris []stringtoGetDeveloperAppsRowand scan it from the query. - Minor whitespace cleanup in
api/v1_oauth.go.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
api/v1_oauth.go |
Removes an extra whitespace-only line (no functional change). |
api/dbv1/queries/get_developer_apps.sql |
Adds redirect_uris aggregation via join to oauth_redirect_uris. |
api/dbv1/get_developer_apps.sql.go |
sqlc regen: includes RedirectUris field and scans it from query results. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| da.description, | ||
| da.image_url, | ||
| COALESCE(ARRAY_AGG(oau.redirect_uri ORDER BY oau.id) FILTER (WHERE oau.redirect_uri IS NOT NULL), ARRAY[]::text[])::text[] AS redirect_uris | ||
| FROM developer_apps da | ||
| LEFT JOIN oauth_redirect_uris oau ON oau.client_id = da.address |
There was a problem hiding this comment.
New redirect_uris aggregation is now part of the GetDeveloperApps result set, but there’s no test coverage exercising this behavior (e.g., when URIs exist and when none exist). Please extend the existing developer app query/API tests to assert redirect_uris is returned (and is an empty array rather than null) and that ordering is deterministic (by oauth_redirect_uris.id).
There was a problem hiding this comment.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Added test coverage in e70017c:
TestGetDeveloperAppsQueries: assertsRedirectUrisequals[]string{}(not nil) at the query layer when no URIs are registeredTestGetDeveloperApp: asserts the deserializedRedirectUrisfield is an empty slice (not nil) from the/v1/developer_apps/:addressendpointTestV1UsersDeveloperApps: usesgjson.IsArray()to assertredirect_urisis a JSON array (notnull) with length 0 for each app without registered URIsTestV1UsersDeveloperAppsRedirectUrisOrdering(new): inserts URIs withzbeforeaalphabetically but in ascending id order, then asserts the response matches insertion order — confirming ordering byoauth_redirect_uris.id, not alphabetically. Also asserts the second app (no URIs) returns[]notnull.
Agent-Logs-Url: https://github.com/AudiusProject/api/sessions/a6bf18a2-f093-43e3-b3bd-fe551aef12f8 Co-authored-by: rickyrombo <3690498+rickyrombo@users.noreply.github.com>
TestGetDeveloperAppsQueriesto assertRedirectUrisis an empty slice (not nil)TestGetDeveloperAppto assertredirect_urisis an empty slice (not nil) in the JSON responseTestV1UsersDeveloperAppsto assertredirect_urisis a JSON array (not null) with length 0 for apps without URIsTestV1UsersDeveloperAppsRedirectUrisOrdering: verifies URIs are ordered byoauth_redirect_uris.id(not alphabetically), and that apps without URIs return[]notnull💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.