feat(api): add tag prefix filtering to releases API #38513 - #38681
feat(api): add tag prefix filtering to releases API #38513#38681gomitrah wants to merge 8 commits into
Conversation
The pre-release param was missing its boolean type and tag_prefix had a stray duplicate type line, causing swagger-check to fail. Assisted-by: Claude Code:claude-sonnet-5
|
@silverwind
|
|
LIKE filter is better, thank. But with those |
@silverwind I followed the same approach for tag_filter, allowing a single wildcard-based filter to support exact, prefix, suffix, and substring matching. I've updated the implementation and pushed the changes. |
silverwind
left a comment
There was a problem hiding this comment.
Nice solution with *, thanks.
| link.RawQuery = url.Values{"tag_filter": {"*1.0*"}}.Encode() | ||
| resp = MakeRequest(t, NewRequest(t, "GET", link.String()).AddTokenAuth(token), http.StatusOK) | ||
| apiReleases = DecodeJSON(t, resp, []*api.Release{}) | ||
|
|
||
| if assert.Len(t, apiReleases, 1) { | ||
| for _, release := range apiReleases { | ||
| assert.Contains(t, release.TagName, "1.0") | ||
| } | ||
| } |
There was a problem hiding this comment.
I believe the testFilterByLen should be refactored to testFilterByTagNames and make it accept an expected names slice to "assert".
There was a problem hiding this comment.
I've refactored the test helper from testFilterByLen to testFilterByTagNames as suggested. The helper now accepts the expected tag names and validates the returned tag list directly using assert.ElementsMatch, making the test verify the actual API response instead of only the number of results. . Please review and let me know if any.
There was a problem hiding this comment.
I believe the
testFilterByLenshould be refactored totestFilterByTagNamesand make it accept an expected names slice to "assert".
I don't understand why it still makes sense to keep the badly-designed "testFilterByLen" function .
87998be to
ebacc63
Compare
Add tag prefix filtering to
/repos/{owner}/{repo}/releasesAPIRoot Cause
The releases API endpoint currently returns all releases without a way to filter by tag prefix. In repositories with multiple artifacts or monorepo release tags, clients must fetch many pages and filter releases locally, causing unnecessary API requests and server-side processing.
Fixes #38513
Before This Change
/repos/{owner}/{repo}/releases.Solution
Add support for a
tag_filterquery parameter in the releases API.The API now filters releases and returns only releases whose tag names start with the provided prefix.
Implementation Details
tag_filterin the releases API.tag_filteris not provided.make generate-swagger) to reflect the new parameter.