MCPcopy
hub / github.com/GitbookIO/gitbook / createFileSystem

Function createFileSystem

packages/openapi-parser/src/filesystem.ts:12–37  ·  view source on GitHub ↗
(
    input: Pick<ParseOpenAPIInput, 'value' | 'rootURL' | 'options'>
)

Source from the content-addressed store, hash-verified

10 * Fetches all the URLs specified in references and builds a filesystem.
11 */
12export async function createFileSystem(
13 input: Pick<ParseOpenAPIInput, 'value' | 'rootURL' | 'options'>
14): Promise<Filesystem> {
15 const { value, rootURL, options } = input;
16
17 const result = await bundle(value, {
18 treeShake: false,
19 plugins: [
20 fetchURL(),
21 parseYaml(),
22 parseJson(),
23 fetchURLs({ rootURL }),
24 ...(options?.plugins || []),
25 ],
26 });
27
28 return [
29 {
30 dir: '.',
31 isEntrypoint: true,
32 references: [],
33 filename: 'openapi.json',
34 specification: result,
35 },
36 ];
37}

Callers 3

traverse.test.tsFile · 0.90
filesystem.test.tsFile · 0.90
parseOpenAPIV3Function · 0.90

Calls 2

fetchURLFunction · 0.90
fetchURLsFunction · 0.90

Tested by

no test coverage detected