Skip to content

Commit 1fe00a7

Browse files
github: annotate initial request types with //meta:schema
Annotate 25 dedicated request body types (26 annotations) so that check-schema-fields validates them against the OpenAPI descriptions. All annotations verify clean against the current descriptions: "Found 0 schema field issues; Checked 26 annotations on 25 annotated structs". Further annotations can land incrementally alongside future pass-by-value conversions for google#3644.
1 parent ccd7712 commit 1fe00a7

15 files changed

Lines changed: 51 additions & 0 deletions

‎github/gists_comments.go‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,16 @@ func (g GistComment) String() string {
2424
}
2525

2626
// CreateGistCommentRequest represents the input for creating a gist comment.
27+
//
28+
//meta:schema request POST /gists/{gist_id}/comments
2729
type CreateGistCommentRequest struct {
2830
// Body is the comment text.
2931
Body string `json:"body"`
3032
}
3133

3234
// UpdateGistCommentRequest represents the input for updating a gist comment.
35+
//
36+
//meta:schema request PATCH /gists/{gist_id}/comments/{comment_id}
3337
type UpdateGistCommentRequest struct {
3438
// Body is the comment text.
3539
Body string `json:"body"`

‎github/issues_comments.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ func (i IssueComment) String() string {
5151
}
5252

5353
// IssueCommentRequest represents a request to create or update an issue comment.
54+
//
55+
//meta:schema request POST /repos/{owner}/{repo}/issues/{issue_number}/comments
56+
//meta:schema request PATCH /repos/{owner}/{repo}/issues/comments/{comment_id}
5457
type IssueCommentRequest struct {
5558
Body string `json:"body"`
5659
}

‎github/issues_milestones.go‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ func (m Milestone) String() string {
3535
}
3636

3737
// CreateMilestoneRequest represents a request to create a milestone.
38+
//
39+
//meta:schema request POST /repos/{owner}/{repo}/milestones
3840
type CreateMilestoneRequest struct {
3941
Title string `json:"title"`
4042
State *string `json:"state,omitempty"`
@@ -43,6 +45,8 @@ type CreateMilestoneRequest struct {
4345
}
4446

4547
// UpdateMilestoneRequest represents a request to update a milestone.
48+
//
49+
//meta:schema request PATCH /repos/{owner}/{repo}/milestones/{milestone_number}
4650
type UpdateMilestoneRequest struct {
4751
Title *string `json:"title,omitempty"`
4852
State *string `json:"state,omitempty"`

‎github/orgs_custom_repository_roles.go‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ type CustomRepoRoles struct {
3131
}
3232

3333
// CreateCustomRepoRoleRequest represents the parameters to create a custom repository role.
34+
//
35+
//meta:schema request POST /orgs/{org}/custom-repository-roles
3436
type CreateCustomRepoRoleRequest struct {
3537
Name string `json:"name"`
3638
Description *string `json:"description,omitempty"`
@@ -39,6 +41,8 @@ type CreateCustomRepoRoleRequest struct {
3941
}
4042

4143
// UpdateCustomRepoRoleRequest represents the parameters to update a custom repository role.
44+
//
45+
//meta:schema request PATCH /orgs/{org}/custom-repository-roles/{role_id}
4246
type UpdateCustomRepoRoleRequest struct {
4347
Name *string `json:"name,omitempty"`
4448
Description *string `json:"description,omitempty"`

‎github/pulls_comments.go‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ func (s *PullRequestsService) GetComment(ctx context.Context, owner, repo string
144144

145145
// CreatePullRequestCommentRequest represents a request to create a review
146146
// comment on a pull request.
147+
//
148+
//meta:schema request POST /repos/{owner}/{repo}/pulls/{pull_number}/comments
147149
type CreatePullRequestCommentRequest struct {
148150
Body string `json:"body"`
149151
CommitID string `json:"commit_id"`
@@ -160,6 +162,8 @@ type CreatePullRequestCommentRequest struct {
160162

161163
// UpdatePullRequestCommentRequest represents a request to update a review
162164
// comment on a pull request.
165+
//
166+
//meta:schema request PATCH /repos/{owner}/{repo}/pulls/comments/{comment_id}
163167
type UpdatePullRequestCommentRequest struct {
164168
Body string `json:"body"`
165169
}

‎github/pulls_reviews.go‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ func (r *PullRequestReviewRequest) isComfortFadePreview() (bool, error) {
9494
}
9595

9696
// PullRequestDismissReviewRequest represents a request to dismiss a review.
97+
//
98+
//meta:schema request PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals
9799
type PullRequestDismissReviewRequest struct {
98100
Message string `json:"message"`
99101
Event *string `json:"event,omitempty"`
@@ -104,6 +106,8 @@ func (r PullRequestDismissReviewRequest) String() string {
104106
}
105107

106108
// PullRequestSubmitReviewRequest represents a request to submit a review.
109+
//
110+
//meta:schema request POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events
107111
type PullRequestSubmitReviewRequest struct {
108112
Body *string `json:"body,omitempty"`
109113
Event string `json:"event"`

‎github/repos.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,8 @@ func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repo
619619
}
620620

621621
// TemplateRepoRequest represents a request to create a repository from a template.
622+
//
623+
//meta:schema request POST /repos/{template_owner}/{template_repo}/generate
622624
type TemplateRepoRequest struct {
623625
Name string `json:"name"`
624626
Owner *string `json:"owner,omitempty"`

‎github/repos_autolinks.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import (
1111
)
1212

1313
// CreateAutolinkRequest specifies parameters for RepositoriesService.CreateAutolink method.
14+
//
15+
//meta:schema request POST /repos/{owner}/{repo}/autolinks
1416
type CreateAutolinkRequest struct {
1517
KeyPrefix string `json:"key_prefix"`
1618
URLTemplate string `json:"url_template"`

‎github/repos_deployment_branch_policies.go‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@ type DeploymentBranchPolicyResponse struct {
2525
}
2626

2727
// CreateDeploymentBranchPolicyRequest represents a request to create a deployment branch policy.
28+
//
29+
//meta:schema request POST /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies
2830
type CreateDeploymentBranchPolicyRequest struct {
2931
Name string `json:"name"`
3032
Type *string `json:"type,omitempty"`
3133
}
3234

3335
// UpdateDeploymentBranchPolicyRequest represents a request to update a deployment branch policy.
36+
//
37+
//meta:schema request PUT /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id}
3438
type UpdateDeploymentBranchPolicyRequest struct {
3539
Name string `json:"name"`
3640
}

‎github/repos_keys.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ func (s *RepositoriesService) GetKey(ctx context.Context, owner, repo string, id
6161
}
6262

6363
// CreateDeployKeyRequest represents a request to create a deploy key.
64+
//
65+
//meta:schema request POST /repos/{owner}/{repo}/keys
6466
type CreateDeployKeyRequest struct {
6567
Title *string `json:"title,omitempty"`
6668
Key string `json:"key"`

0 commit comments

Comments
 (0)