Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#1,024 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
github, javascript, openapi

調査の方向性

script/build-schemaから始めて、GitHub OpenAPIスナップショットの選択方法を確認し、そのソースをdescriptions-next/と比較します。schema/dereferenced/settings.jsonを再生成し、issueに示されているnullable設定を検証します。required_status_checksとrestrictionsが、nullableに依存せずdraft 2020-12でnullを受け入れれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
JavaScript
スター
922
フォーク
227
平均マージ
7日 20時間
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

github-community-projects/safe-settings のほかの issue

github-community-projects/safe-settings の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。