Skip to content

refactor!: Pass TemplateRepoRequest by value in Repositories.CreateFromTemplate#4378

Open
JamBalaya56562 wants to merge 1 commit into
google:masterfrom
JamBalaya56562:refactor/3644-template-repo-value-params
Open

refactor!: Pass TemplateRepoRequest by value in Repositories.CreateFromTemplate#4378
JamBalaya56562 wants to merge 1 commit into
google:masterfrom
JamBalaya56562:refactor/3644-template-repo-value-params

Conversation

@JamBalaya56562

Copy link
Copy Markdown
Contributor

Towards #3644.

Repositories.CreateFromTemplate now takes its TemplateRepoRequest body by value instead of by pointer, and the required name property becomes a non-pointer string (its omitempty is dropped), so the required body is enforced at compile time.

The OpenAPI schema for POST /repos/{template_owner}/{template_repo}/generate lists name as the only required property, and its properties (owner, name, description, include_all_branches, private) map 1:1 to the struct — no fields are missing, so nothing is added.

TemplateRepoRequest is removed from the paramcheck body-allowed-pointer-types allowlist in .golangci.yml, and the generated accessors are regenerated (GetName now returns the value directly).

…eFromTemplate`

Towards google#3644.

BREAKING CHANGE: Repositories.CreateFromTemplate now takes TemplateRepoRequest by value, and TemplateRepoRequest.Name is now a non-pointer string.
@gmlewis gmlewis 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 10, 2026

@gmlewis gmlewis 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

@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.51%. Comparing base (c0e2323) to head (fae6474).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4378   +/-   ##
=======================================
  Coverage   97.51%   97.51%           
=======================================
  Files         193      193           
  Lines       19526    19526           
=======================================
  Hits        19040    19040           
  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.

Comment thread github/repos.go
@@ -621,7 +621,7 @@ func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repo
// TemplateRepoRequest represents a request to create a repository from a template.
type TemplateRepoRequest struct {
// Name is required when creating a repo.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment is redundant and can be removed.

Suggested change
// Name is required when creating a repo.

Comment thread github/repos.go
Name string `json:"name"`
Owner *string `json:"owner,omitempty"`
Description *string `json:"description,omitempty"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's remove this empty line:

Suggested change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). NeedsReview PR is awaiting a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants