Generated schemas keep OpenAPI `nullable`, so required-but-nullable fields reject null
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- github, javascript, openapi
- 领域
- api, build-system, tooling
调研方向
从 script/build-schema 开始,检查它如何选择 GitHub OpenAPI 快照,然后将该来源与 descriptions-next/ 进行比较。重新生成 schema/dereferenced/settings.json,并验证 issue 中所示的 nullable 配置;当 required_status_checks 和 restrictions 在 draft 2020-12 下接受 null,且不依赖 nullable 时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
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 小时
- 30 天内合并 PR
- 1
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
github-community-projects/safe-settings 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 1/5 1 小时以内 新手友好度 88/100
-
Bug Report: environment and repo variables API calls don't paginate, failing with more than 10 items未关闭
难度 2/5 1-3 小时 新手友好度 85/100
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
查看 github-community-projects/safe-settings 的全部 Issue
相似的 Issue
-
Design only Leadership Survey SLFS
难度 2/5 1-3 小时 新手友好度 70/100
bcgov/digital-journeys#2293 ·
-
Toolkit
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
API Bug
难度 2/5 1-3 小时 新手友好度 78/100
ProjectSidewalk/SidewalkWebpage#5556 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
jessepollak/home#1454 ·
维护者通常 1 天内回复
-
Mend: dependency security vulnerability untriaged
难度 2/5 1-3 小时 新手友好度 64/100
opensearch-project/OpenSearch-Dashboards#12822 ·
维护者通常 1 天内回复