Generated schemas keep OpenAPI `nullable`, so required-but-nullable fields reject null
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 72/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- github, javascript, openapi
- Lĩnh vực
- api, build-system, tooling
Hướng nghiên cứu
Bắt đầu với script/build-schema và kiểm tra cách nó chọn snapshot GitHub OpenAPI, sau đó so sánh nguồn đó với descriptions-next/. Tạo lại schema/dereferenced/settings.json và xác thực cấu hình nullable được nêu trong issue; hoàn tất khi required_status_checks và restrictions chấp nhận null trong draft 2020-12 mà không dựa vào nullable.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
The schemas in schema/dereferenced/ declare "$schema": "https://json-schema.org/draft/2020-12/schema", but script/build-schema copies subschemas out of GitHub's OpenAPI 3.0 description, which marks null-able fields with nullable: true. That keyword doesn't exist in JSON Schema draft 2020-12, so any compliant validator ignores it and the fields reject null.
This bites exactly where the GitHub API forces null into configs. The update-branch-protection endpoint requires required_status_checks, enforce_admins, and restrictions to be present, and documents "Set to null to disable". A minimal config:
branches:
- name: main
protection:
required_status_checks: null
enforce_admins: true
restrictions: null
fails validation against the current schema/dereferenced/settings.json:
$.branches[0].protection.required_status_checks: None is not of type 'object'
$.branches[0].protection.restrictions: None is not of type 'object'
There are 13-14 nullable: true occurrences per generated file, all silently dropped this way.
GitHub publishes an OpenAPI 3.1 variant of the same spec (descriptions-next/, same dated snapshots). 3.1 is natively JSON Schema 2020-12: those fields are type: [X, "null"] unions and nullable doesn't exist. Pointing the build at it makes the generated schemas actually conform to the dialect they declare, with no post-processing.
- Ngôn ngữ chính
- JavaScript
- Star
- 922
- Fork
- 227
- Merge trung bình
- 7 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
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-community-projects/safe-settings
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
-
Bug Report: environment and repo variables API calls don't paginate, failing with more than 10 itemsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Tất cả issue của github-community-projects/safe-settings
Issue tương tự
-
bug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
amponce/archive-movie-browser#354 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
saayam-for-all/webapp#1870 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Imageomics/OpenCite#66 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
chr15m/twiiit.com#20 ·
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
antropos17/Aegis#629 ·
Maintainer thường phản hồi trong vòng 4 ngày