MCPcopy
hub / github.com/github/docs / check

Function check

src/rest/scripts/openapi-check.js:34–57  ·  view source on GitHub ↗
(files)

Source from the content-addressed store, hash-verified

32}
33
34async function check(files) {
35 console.log('Verifying OpenAPI files are valid with decorator')
36 const documents = files.map((filename) => [
37 filename,
38 JSON.parse(fs.readFileSync(path.join(process.cwd(), filename))),
39 ])
40
41 for (const [filename, schema] of documents) {
42 try {
43 // munge OpenAPI definitions object in an array of operations objects
44 const operations = await getOperations(schema)
45 // process each operation, asynchronously rendering markdown and stuff
46 await Promise.all(operations.map((operation) => operation.process()))
47
48 console.log(`Successfully could decorate OpenAPI operations for document ${filename}`)
49 } catch (error) {
50 console.error(error)
51 console.log(
52 `🐛 Whoops! It looks like the decorator script wasn't able to parse the dereferenced schema in file ${filename}. A recent change may not yet be supported by the decorator. Please reach out in the #docs-engineering slack channel for help.`
53 )
54 process.exit(1)
55 }
56 }
57}

Callers 1

openapi-check.jsFile · 0.85

Calls 2

getOperationsFunction · 0.85
processMethod · 0.45

Tested by

no test coverage detected