mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-25 04:20:02 +00:00
OpenAPI: Change generated file paths for documents
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'fumadocs-openapi': patch
|
||||
---
|
||||
|
||||
Change generated file paths for documents
|
||||
@@ -90,12 +90,10 @@ export async function generateFiles(options: Config): Promise<void> {
|
||||
if (result.pathItem.summary) {
|
||||
file = getFilename(result.pathItem.summary);
|
||||
} else if (result.type === 'operation') {
|
||||
file = result.operation.operationId
|
||||
? getFilename(result.operation.operationId)
|
||||
: join(
|
||||
getOutputPathFromRoute(result.item.path),
|
||||
result.item.method.toLowerCase(),
|
||||
);
|
||||
file = join(
|
||||
getOutputPathFromRoute(result.item.path),
|
||||
result.item.method.toLowerCase(),
|
||||
);
|
||||
} else {
|
||||
file = getFilename(result.item.name);
|
||||
}
|
||||
|
||||
@@ -125,26 +125,17 @@ describe('Generate documents', () => {
|
||||
expect(fs.writeFile).toBeCalledTimes(3);
|
||||
|
||||
expect(fs.writeFile).toBeCalledWith(
|
||||
join(cwd, './out/products/get-product-details.mdx'),
|
||||
join(cwd, './out/products/products/get.mdx'),
|
||||
expect.anything(),
|
||||
);
|
||||
|
||||
expect(fs.writeFile).toBeCalledWith(
|
||||
join(cwd, './out/products/get-inventory-for-product.mdx'),
|
||||
join(cwd, './out/inventory/inventory/get.mdx'),
|
||||
expect.anything(),
|
||||
);
|
||||
|
||||
expect(fs.writeFile).toBeCalledWith(
|
||||
join(cwd, './out/inventory/get-inventory-for-product.mdx'),
|
||||
expect.anything(),
|
||||
);
|
||||
|
||||
expect(fs.mkdir).toBeCalledWith(
|
||||
join(cwd, './out/inventory'),
|
||||
expect.anything(),
|
||||
);
|
||||
expect(fs.mkdir).toBeCalledWith(
|
||||
join(cwd, './out/products'),
|
||||
join(cwd, './out/products/inventory/get.mdx'),
|
||||
expect.anything(),
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user