Skip to content

Commit a6c43fe

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
fix(docs): retain nullable overrides on output spreads
1 parent 4a6132d commit a6c43fe

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

apps/docs/content/docs/integrations/github.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Fetch PR details including diff and files changed
6666
| `body` | string (nullable) | PR description |
6767
| `merged` | boolean | Whether PR is merged |
6868
| `mergeable` | boolean (nullable) | Whether PR is mergeable |
69-
| `merged_by` | object | GitHub user object |
69+
| `merged_by` | object (nullable) | GitHub user object |
7070
|`login` | string | GitHub username |
7171
|`id` | number | User ID |
7272
|`avatar_url` | string | Avatar image URL |
@@ -673,7 +673,7 @@ Submit a review for a pull request. Use APPROVE, REQUEST_CHANGES, or COMMENT. A
673673
| Parameter | Type | Description |
674674
| --------- | ---- | ----------- |
675675
| `id` | number | Review ID |
676-
| `user` | object | GitHub user object |
676+
| `user` | object (nullable) | GitHub user object |
677677
|`login` | string | GitHub username |
678678
|`id` | number | User ID |
679679
|`avatar_url` | string | Avatar image URL |

scripts/generate-docs.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,20 @@ describe('documentation tool metadata', () => {
8383
expect(markdown).toContain('| `count` | number |')
8484
})
8585

86+
it('renders nullable overrides on spread-based output definitions', async () => {
87+
const [block] = extractAllBlockConfigs(
88+
fs.readFileSync(path.resolve('apps/sim/blocks/blocks/github.ts'), 'utf-8')
89+
)
90+
const markdown = await generateMarkdownForBlock({
91+
...block,
92+
tools: { access: ['github_create_pr_review_v2'] },
93+
})
94+
expect(markdown).toContain('| `user` | object (nullable) |')
95+
96+
const outputs = parsePropertiesContent('user: { ...USER_OUTPUT, nullable: false },', 'github')
97+
expect(outputs.user).toMatchObject({ type: 'object', nullable: false })
98+
})
99+
86100
it('uses evaluated outputs for factory-defined tools', async () => {
87101
const approve = await getToolInfo('sailpoint_approve_access_request')
88102
const identity = await getToolInfo('sailpoint_get_identity')

scripts/generate-docs.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3628,6 +3628,11 @@ function parseFieldContent(fieldContent: string, toolPrefix?: string, propertyNa
36283628
if (description) {
36293629
result.description = description
36303630
}
3631+
const nullableOverride = findTopLevelMatch(
3632+
blankStringsAndComments(fieldContent) ?? '',
3633+
/\bnullable\s*:\s*(true|false)\b/
3634+
)
3635+
if (nullableOverride) result.nullable = nullableOverride[1] === 'true'
36313636
return result
36323637
}
36333638
}

0 commit comments

Comments
 (0)