[Schema Inaccuracy] `permission` on Add a repository collaborator is valid on personal-account repositories

Đang mở Phù hợp với người mới
#7,010 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
85/100
Loại issue
Tài liệu
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
openapi
Lĩnh vực
api, documentation

Hướng nghiên cứu

Bắt đầu trong descriptions/[api.github.com/], kiểm tra api.github.com.2022-11-28.json và api.github.com.2026-03-10.json cho thao tác Add a repository collaborator. Cập nhật mô tả tham số permission để phân biệt các repository của tài khoản cá nhân và các repository thuộc tổ chức, sau đó xác minh rằng cả hai phiên bản đều nhất quán trong việc ghi lại các giá trị được chấp nhận và các hạn chế.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

documentation

Schema Inaccuracy

Operation: PUT /repos/{owner}/{repo}/collaborators/{username} (Add a repository
collaborator).

The description of the permission body parameter states:

The permission to grant the collaborator. Only valid on organization-owned repositories.

That restriction does not hold. On a repository owned by a personal account the parameter
is honoured for pull, push and admin. Only triage and maintain are
organization-only.

Expected

The permission parameter description should state that on organization-owned
repositories all of pull, triage, push, maintain, admin and custom repository
roles are accepted, while on repositories owned by a personal account only pull, push
and admin are accepted — triage and maintain return 422 Validation Failed.

Reproduction Steps

Against a private repository owned by a personal account:

$ curl -X PUT
-H "Authorization: Bearer $TOKEN"
-H "Accept: application/vnd.github+json"
-H "X-GitHub-Api-Version: 2022-11-28"
https://api.github.com/repos/OWNER/REPO/collaborators/USERNAME
-d '{"permission":"pull"}'

→ HTTP 201, and the returned invitation object contains "permissions": "read".

Full sweep of all five values, cancelling the invitation between attempts:

requested HTTP recorded permissions
pull 201 read
triage 422 Validation Failed
push 201 write
maintain 422 Validation Failed
admin 201 admin

Identical sweep against a private organization-owned repository, same script and
token: all five accepted and recorded as requested.

Enforcement matches what is recorded: a collaborator granted pull on a private
personal-account repository has git push rejected by the server.

Note on versioning: this description is identical in both published API versions in
descriptions/[api.github.com/](http://api.github.com/) on mainapi.github.com.2022-11-28.json and
api.github.com.2026-03-10.json both contain the "Only valid on organization-owned
repositories." sentence verbatim. So this is not a leftover in an older version.

Related documentation issue: github/docs#45537

Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
1.6k
Fork
342
Merge trung bình
3 giờ 33 phút
Pull request đã merge (30 ngày)
51

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của github/rest-api-description

Tất cả issue của github/rest-api-description

Issue tương tự

Thêm issue về Backend & API Design

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.