docs: fix broken API doc anchors in milestones and cluster_agents
What does this MR do?
GitLab renamed section titles on a few API doc pages, so many doc links in the Go files point at anchors that no longer exist. The pages open, but at the top instead of at the method. This MR fixes them for two files in one go, as asked in the review (it combines this MR with !3122 (closed)).
milestones.go
GitLab renamed the section titles on the Project milestones API page, so 12 of the 14 doc links in milestones.go point at anchors that no longer exist. The page opens, but at the top instead of at the method.
This MR points each link at the section that documents the endpoint the method calls:
| Method(s) | Endpoint | Old anchor | New anchor |
|---|---|---|---|
ListMilestones, ListMilestonesOptions |
GET /projects/:id/milestones |
#list-project-milestones |
#list-all-project-milestones |
GetMilestone |
GET /projects/:id/milestones/:milestone_id |
#get-single-milestone |
#retrieve-a-milestone |
CreateMilestone, CreateMilestoneOptions |
POST /projects/:id/milestones |
#create-new-milestone |
#create-a-milestone |
UpdateMilestone, UpdateMilestoneOptions |
PUT /projects/:id/milestones/:milestone_id |
#edit-milestone |
#update-a-milestone |
DeleteMilestone |
DELETE /projects/:id/milestones/:milestone_id |
#delete-project-milestone |
#delete-a-milestone |
GetMilestoneIssues + options |
GET .../milestones/:milestone_id/issues |
#get-all-issues-assigned-to-a-single-milestone |
#list-all-issues-for-a-milestone |
GetMilestoneMergeRequests + options |
GET .../milestones/:milestone_id/merge_requests |
#get-all-merge-requests-assigned-to-a-single-milestone |
#list-all-merge-requests-for-a-milestone |
cluster_agents.go
The Kubernetes agent API page has the same problem: 11 of the 16 doc links in cluster_agents.go point at anchors that no longer exist. The page opens, but at the top instead of at the method.
This MR points each link at the section that documents the endpoint the method calls:
| Method(s) | Endpoint | Old anchor | New anchor |
|---|---|---|---|
ListAgents, ListAgentsOptions |
GET /projects/:id/cluster_agents |
#list-the-agents-for-a-project |
#list-all-agents |
GetAgent |
GET /projects/:id/cluster_agents/:agent_id |
#get-details-about-an-agent |
#retrieve-an-agent |
RegisterAgent, RegisterAgentOptions |
POST /projects/:id/cluster_agents |
#register-an-agent-with-a-project |
#create-an-agent |
DeleteAgent |
DELETE /projects/:id/cluster_agents/:agent_id |
#delete-a-registered-agent |
#delete-an-agent |
ListAgentTokens, ListAgentTokensOptions, AgentToken |
GET .../cluster_agents/:agent_id/tokens |
#list-tokens-for-an-agent |
#list-all-agent-tokens |
GetAgentToken |
GET .../cluster_agents/:agent_id/tokens/:token_id |
#get-a-single-agent-token |
#retrieve-an-agent-token |
It also removes a copy of the ListAgents doc comment in ClusterAgentsServiceInterface. The same four comment lines (with the same broken link) were there twice in a row.
This is the same kind of fix as !2723 (merged), !2777 (merged) and !2779 (merged).
How was this checked?
-
Every new anchor was checked against the
idvalues in the live HTML of https://docs.gitlab.com/api/milestones/. After the change, all 14 links in the file resolve (before: 12 broken). -
Each mapping was checked against the route constant and HTTP method the function uses.
-
Comment-only change.
-
Every new anchor was checked against the
idvalues in the live HTML of https://docs.gitlab.com/api/cluster_agents/. After the change, all 15 links in the file resolve (before: 11 of 16 broken; one link is removed with the duplicate comment). -
Each mapping was checked against the route constant and HTTP method the function uses.
-
Comment-only change.
This contribution was prepared with the help of an AI assistant. I reviewed the changes and take responsibility for them.