Skip to content

Commit 70d14f9

Browse files
maurisrohit-gohri
andauthored
update paths to watch for handling multi-file OpenAPI docs (#219)
* update paths to watch for handling multi-file OpenAPI docs * Create small-poets-sing.md * also watch the main file Co-authored-by: Rohit Gohri <code@rohit.page>
1 parent 498514b commit 70d14f9

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

.changeset/small-poets-sing.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"docusaurus-plugin-redoc": patch
3+
---
4+
5+
Update paths to watch for handling multi-file OpenAPI docs

packages/docusaurus-plugin-redoc/src/index.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export default function redocPlugin(
4646
'redocusaurus',
4747
`${options.id || 'api-spec'}.yaml`,
4848
);
49+
let filesToWatch: string[] = isSpecFile ? [path.resolve(spec)] : [];
4950

5051
if (debug) {
5152
console.error('[REDOCUSAURUS_PLUGIN] Opts Input:', opts);
@@ -86,11 +87,17 @@ export default function redocPlugin(
8687
redoclyConfig = await loadConfig();
8788
}
8889

89-
const { bundle: bundledSpec, problems } = await bundle({
90+
const {
91+
bundle: bundledSpec,
92+
problems,
93+
fileDependencies,
94+
} = await bundle({
9095
ref: spec,
9196
config: redoclyConfig,
9297
});
9398

99+
filesToWatch = [path.resolve(spec), ...fileDependencies];
100+
94101
if (problems?.length) {
95102
console.error('[REDOCUSAURUS_PLUGIN] errors while bundling spec', spec);
96103

@@ -184,7 +191,7 @@ export default function redocPlugin(
184191
if (!isSpecFile) {
185192
return [];
186193
}
187-
return [path.resolve(spec)];
194+
return filesToWatch;
188195
},
189196
};
190197
}

0 commit comments

Comments
 (0)