@@ -229,4 +229,73 @@ describe('getGHExample - GitHub CLI code generation', () => {
229229 expect ( result ) . toContain ( '"tag2"' )
230230 expect ( result ) . toContain ( '"tag3"' )
231231 } )
232+
233+ test ( 'handles a top-level array body via --input' , ( ) => {
234+ const operation : Operation = {
235+ serverUrl : 'https://api.github.com' ,
236+ verb : 'post' ,
237+ requestPath : '/enterprises/{enterprise}/innersource-vulnerabilities/sync' ,
238+ title : 'Sync InnerSource vulnerabilities' ,
239+ descriptionHTML : '<p>Sync vulnerabilities</p>' ,
240+ previews : [ ] ,
241+ statusCodes : [ ] ,
242+ bodyParameters : [ ] ,
243+ category : 'enterprise-admin' ,
244+ subcategory : 'security-advisories' ,
245+ parameters : [
246+ {
247+ name : 'enterprise' ,
248+ in : 'path' ,
249+ required : true ,
250+ description : 'The enterprise slug' ,
251+ schema : { type : 'string' } ,
252+ } ,
253+ ] ,
254+ codeExamples : [ ] ,
255+ progAccess : {
256+ permissions : [ ] ,
257+ userToServerRest : true ,
258+ serverToServer : true ,
259+ fineGrainedPat : true ,
260+ } ,
261+ }
262+
263+ const codeSample : CodeSample = {
264+ request : {
265+ contentType : 'application/json' ,
266+ description : 'Example' ,
267+ acceptHeader : 'application/vnd.github+json' ,
268+ bodyParameters : [
269+ {
270+ id : 'MVS-2026-001' ,
271+ summary : 'Example vulnerability summary' ,
272+ aliases : [ 'GHSA-xxxx-xxxx-xxxx' ] ,
273+ } ,
274+ ] ,
275+ parameters : { enterprise : 'octo-enterprise' } ,
276+ } ,
277+ response : {
278+ statusCode : '200' ,
279+ contentType : 'application/json' ,
280+ description : 'Response' ,
281+ example : { } ,
282+ } ,
283+ }
284+
285+ const currentVersion = 'enterprise-cloud@latest'
286+ const allVersions : Record < string , VersionItem > = {
287+ 'enterprise-cloud@latest' : {
288+ version : 'enterprise-cloud@latest' ,
289+ versionTitle : 'Enterprise Cloud' ,
290+ apiVersions : [ '2022-11-28' ] ,
291+ latestApiVersion : '2022-11-28' ,
292+ } ,
293+ }
294+
295+ const result = getGHExample ( operation , codeSample , currentVersion , allVersions )
296+
297+ expect ( result ) . toContain ( '--input - <<<' )
298+ expect ( result ) . toContain ( '"MVS-2026-001"' )
299+ expect ( result ) . toContain ( '"GHSA-xxxx-xxxx-xxxx"' )
300+ } )
232301} )
0 commit comments