Skip to content

Commit 1e23f84

Browse files
heiskrCopilot
andauthored
Fix GitHub CLI examples for gist endpoints (#57364)
Co-authored-by: Copilot <[email protected]>
1 parent cccb1c4 commit 1e23f84

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/rest/components/get-rest-code-samples.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,14 @@ export function getGHExample(
206206
}
207207

208208
if (typeof bodyParameters === 'object') {
209+
// Special handling for gist endpoints - use --input for nested file structures
210+
const isGistEndpoint =
211+
operation.requestPath.includes('/gists') &&
212+
(operation.title === 'Create a gist' || operation.title === 'Update a gist')
213+
209214
// For complex objects with arrays, use --input with JSON
210215
const hasArrays = hasNestedArrays(bodyParameters as NestedObjectParameter)
211-
if (hasArrays) {
216+
if (hasArrays || isGistEndpoint) {
212217
const jsonBody = JSON.stringify(
213218
bodyParameters,
214219
(key: string, value: any) => {

0 commit comments

Comments
 (0)