Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Generated schemas keep OpenAPI `nullable`, so required-but-nullable fields reject null

Đang mở
#1,024 0 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ó
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ả

bug

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

  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-community-projects/safe-settings

Tất cả issue của github-community-projects/safe-settings

Issue tương tự

Thêm issue về JavaScript

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.