[Schema Inaccuracy] `/repos/{owner}/{repo}/git/trees` can respond with an undocumented 409
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
- 45/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- github, openapi
- Lĩnh vực
- api, documentation
Hướng nghiên cứu
Bắt đầu với thao tác POST /repos/{owner}/{repo}/git/trees được tài liệu hóa và so sánh các phản hồi của thao tác này với tài liệu tương ứng của git/blobs. Xác minh hành vi 409 của repository trống bằng bản tái hiện, sau đó cập nhật các phản hồi và điều kiện được tài liệu hóa của endpoint khi hành vi dự kiến đã được xác nhận.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Schema Inaccuracy
The route is documented as responding with 403 (forbidden e.g. use doesn't have write access), 404 Not Found (repo does not exist?) or 422 Unprocessable Entitiy (both sha and content specified? possibly also invalid mode, or type?)
However it can also reply with an HTTP 409 Conflict iff the repository is empty, while this is not clearly noted /repos/{owner}/{repo}/git/blobs does document the response code and behaves the same.
Expected
Either documenting the error condition, or allowing the creation of trees and blobs in empty repositories.
Reproduction Steps
import base64
import os
import requests
# add `token` to test with here
s = requests.Session()
s.headers['Accept'] = 'application/vnd.github.v3+json'
s.headers['Authorization'] = f'token {token}'
owner = s.get('https://api.github.com/user').json()['login']
repo = 'test_' + base64.b64encode(os.urandom(6), b'-_').decode()
r = s.post('https://api.github.com/user/repos', json={
'name': repo,
'has_issues': False,
'has_projects': False,
'has_wiki': False,
'auto_init': False,
# at least one merge method must be enabled :(
'allow_squash_merge': False,
# 'allow_merge_commit': False,
'allow_rebase_merge': False,
})
r.raise_for_status()
r = s.post(f'https://api.github.com/repos/{owner}/{repo}/git/trees', json={
'tree': [{
'path': 'a',
'mode': '100644',
'type': 'blob',
'content': 'this is my content'
}]
})
print(r.status_code, r.reason)
for k, v in r.headers.items():
print(f'{k}: {v}')
print()
print(r.text)
- 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
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của github/rest-api-description
-
feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
github/rest-api-description#7201 ·
-
feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
github/rest-api-description#7163 ·
-
Runner deprecations: registration_deprecates_at is declared on the response but never returned Đang mởfeature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
github/rest-api-description#7162 ·
-
feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
github/rest-api-description#7135 ·
-
feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
github/rest-api-description#7111 · 1 bình luận ·
Tất cả issue của github/rest-api-description
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
crossplane/crossplane#7859 ·
-
bot:ai-assisted component:compact-js status:untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
midnightntwrk/midnight-sdk#403 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nightscout/nocturne#1379 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
octobercms/october#6130 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ClickHouse/clickhouse-connect#1057 ·