MCPcopy
hub / github.com/github/docs / getRestOperations

Function getRestOperations

src/rest/scripts/utils/decorator.js:25–46  ·  view source on GitHub ↗
(restSchemas)

Source from the content-addressed store, hash-verified

23}
24
25async function getRestOperations(restSchemas) {
26 console.log('\n⏭️ Start generating static REST files\n')
27 const restSchemaData = await getDereferencedFiles(restSchemas)
28 const restOperations = {}
29 for (const [schemaName, schema] of Object.entries(restSchemaData)) {
30 try {
31 // get all of the operations and wehbooks for a particular version of the openapi
32 const operations = await getOperations(schema)
33 // process each operation and webhook, asynchronously rendering markdown and stuff
34 if (operations.length) {
35 console.log(`...processing ${schemaName} rest operations`)
36 await Promise.all(operations.map((operation) => operation.process()))
37 restOperations[schemaName] = operations
38 }
39 } catch (error) {
40 throw new Error(
41 "🐛 Whoops! It looks like the decorator script wasn't able to parse the dereferenced schema. A recent change may not yet be supported by the decorator. Please reach out in the #docs-engineering slack channel for help."
42 )
43 }
44 }
45 return restOperations
46}
47
48async function getWebhookOperations(webhookSchemas) {
49 console.log('⏭️ Start generating static webhook files\n')

Callers 1

decorateFunction · 0.85

Calls 3

getDereferencedFilesFunction · 0.85
getOperationsFunction · 0.85
processMethod · 0.45

Tested by

no test coverage detected