Skip to content

refactor!: Rename AutolinkOptions to CreateAutolinkRequest, AddAutolink to CreateAutolink, and pass the body by value - #4399

Merged
gmlewis merged 1 commit into
google:masterfrom
JamBalaya56562:refactor/3644-autolink-value-params
Jul 21, 2026
Merged

refactor!: Rename AutolinkOptions to CreateAutolinkRequest, AddAutolink to CreateAutolink, and pass the body by value#4399
gmlewis merged 1 commit into
google:masterfrom
JamBalaya56562:refactor/3644-autolink-value-params

Conversation

@JamBalaya56562

Copy link
Copy Markdown
Contributor

Continues the request-body-by-value work in #3644, this time for RepositoriesService.AddAutolink.

What changed

  • AutolinkOptions is renamed to CreateAutolinkRequest, following the ...Request convention for request bodies. The old name was in the body-allowed-wrong-names allowlist.
  • AddAutolink is renamed to CreateAutolink to match the docs operation name, Create an autolink reference for a repository. The doc comment already read "creates an autolink reference".
  • The request body is now passed by value, and both AutolinkOptions entries are removed from the .golangci.yml allowlists.
  • key_prefix and url_template are required by the API, so KeyPrefix and URLTemplate become non-pointer string without omitempty. is_alphanumeric is optional (it defaults to true), so IsAlphanumeric stays *bool.

Notes

  • The request schema has exactly these three properties, so nothing was missing from the Go struct and no field needed to be added.
  • The response type Autolink is a separate struct and is unchanged — this is a request-only type, so there is no create/update split to consider.
  • test/integration/repos_test.go builds under the root module with -tags integration, so it is updated too. Its comparison needed a small fix rather than a mechanical rename: it compared actionlink.KeyPrefix (*string) against the request field, which is now a string, so it goes through GetKeyPrefix()/GetURLTemplate() instead.

Verified with go build ./..., go vet -tags integration ./test/integration/, gofmt, the full ./github/ test suite (CreateAutolink and the regenerated accessors at 100%), and custom-gcl (no paramcheck findings after removing the allowlist entries).

Updates #3644

BREAKING CHANGE: AutolinkOptions is renamed to CreateAutolinkRequest with non-pointer KeyPrefix and URLTemplate; RepositoriesService.AddAutolink is renamed to CreateAutolink and now takes the request body by value.

cc @jvm986 — flagging for #3644 coordination; this one is in the repos service, so it shouldn't overlap with the Issues work.

…utolink` to `CreateAutolink`, and pass the body by value
Rename the request type to follow the `...Request` convention for request
bodies, and align the method verb with the GitHub API docs operation name
"Create an autolink reference for a repository".
key_prefix and url_template are required by the API, so they become
non-pointer strings without omitempty; is_alphanumeric stays optional.
Both `AutolinkOptions` entries are removed from the .golangci.yml allowlists.
BREAKING CHANGE: AutolinkOptions is renamed to CreateAutolinkRequest with non-pointer KeyPrefix and URLTemplate; RepositoriesService.AddAutolink is renamed to CreateAutolink and now takes the request body by value.
@codecov

codecovBot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.52%. Comparing base (9549a7a) to head (c08e440).

Additional details and impacted files
@@ Coverage Diff @@## master #4399 +/- ##
=======================================
Coverage 97.52% 97.52% =======================================
Files 193 193 Lines 19668 19668 =======================================
Hits 19182 19182 Misses 268 268 Partials 218 218 

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmlewisgmlewis added NeedsReview PR is awaiting a review before merging. Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). labels Jul 21, 2026

@gmlewisgmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @JamBalaya56562!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @alexandear - @Not-Dhananjay-Mishra

@gmlewisgmlewis removed the NeedsReview PR is awaiting a review before merging. label Jul 21, 2026
@gmlewis
gmlewis merged commit e5f31b2 into google:masterJul 21, 2026
15 checks passed
@JamBalaya56562
JamBalaya56562 deleted the refactor/3644-autolink-value-params branch July 23, 2026 22:44
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking API ChangePR will require a bump to the major version num in next release. Look here to see the change(s).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@JamBalaya56562@alexandear@gmlewis