Closed
Description
Schema Inaccuracy
In api.github.com.json, lines 57297- 57312, I can see this:
{
/*...*/
"commit": {
"title": "Commit",
"description": "Commit",
"type": "object",
"properties": {
"url": {
"type": "string",
"format": "uri",
"example": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
"nullable": true /* <<<=== */
},
"sha": {
"type": "string",
"example": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"nullable": true /* <<<=== */
}
/*...*/
}
/*...*/
}
/*...*/
}
Which later results in:
commit: {
url: string | null;
sha: string | null;
//...
}
So, my code:
const branchData = await octokit.repos.getBranch({
owner,
repo,
branch,
});
const sha: string = branchData.data.commit.sha;
Fails to compile with the error:
Type 'string | null' is not assignable to type 'string'.
Type 'null' is not assignable to type 'string'.ts(2322)
Expected
url
and sha
properties on commit
schema should be of type string
instead of string | null
Reproduction Steps
N/A (or see my code example above)