Skip to content

Commit 52048c2

Browse files
authored
docs: Update CONTRIBUTING.md to clarify documentation requirements for exported types (#3693)
1 parent 355aeb9 commit 52048c2

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

CONTRIBUTING.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ file.
9292

9393
## Code Comments
9494

95-
Every exported method needs to have code comments that follow
95+
Every exported method and type needs to have code comments that follow
9696
[Go Doc Comments][]. A typical method's comments will look like this:
9797

9898
```go
@@ -102,9 +102,20 @@ Every exported method needs to have code comments that follow
102102
//
103103
//meta:operation GET /repos/{owner}/{repo}
104104
func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Repository, *Response, error) {
105-
u := fmt.Sprintf("repos/%v/%v", owner, repo)
106-
req, err := s.client.NewRequest("GET", u, nil)
107-
...
105+
u := fmt.Sprintf("repos/%v/%v", owner, repo)
106+
req, err := s.client.NewRequest("GET", u, nil)
107+
...
108+
}
109+
```
110+
And the returned type `Repository` will have comments like this:
111+
112+
```go
113+
// Repository represents a GitHub repository.
114+
type Repository struct {
115+
ID *int64 `json:"id,omitempty"`
116+
NodeID *string `json:"node_id,omitempty"`
117+
Owner *User `json:"owner,omitempty"`
118+
...
108119
}
109120
```
110121

0 commit comments

Comments
 (0)