u
This commit is contained in:
@@ -15,6 +15,35 @@ const routesDocsDir = path.join(docsDir, 'routes');
|
||||
|
||||
const PUBLIC_PATHS = new Set(['/auth/login', '/auth/logout', '/health', '/v1/client']);
|
||||
|
||||
const OMITTED_ROUTES = new Set([
|
||||
'GET /article/export.zip',
|
||||
'POST /article/{sku}/image',
|
||||
'GET /auth/me',
|
||||
'PUT /auth/selected-company',
|
||||
'GET /category/export.zip',
|
||||
'DELETE /company/{id}',
|
||||
'POST /company',
|
||||
'POST /category/{id}/image',
|
||||
'POST /delivery/parse',
|
||||
'GET /events',
|
||||
'GET /health',
|
||||
'GET /image/{fullHash}',
|
||||
'POST /serper/image',
|
||||
'POST /serper/images',
|
||||
'GET /thumb/{fullHash}',
|
||||
'GET /v1/category',
|
||||
'GET /v1/client',
|
||||
'GET /v1/init',
|
||||
'GET /v1/product',
|
||||
]);
|
||||
|
||||
function isRouteOmitted(method, apiPath) {
|
||||
if (apiPath === '/posterminal' || apiPath.startsWith('/posterminal/')) {
|
||||
return true;
|
||||
}
|
||||
return OMITTED_ROUTES.has(`${method.toUpperCase()} ${apiPath}`);
|
||||
}
|
||||
|
||||
const options = {
|
||||
definition: {
|
||||
openapi: '3.0.3',
|
||||
@@ -719,11 +748,13 @@ for (const apiPath of paths) {
|
||||
tags: operation.tags || [],
|
||||
params: summarizeOperationParams(operation),
|
||||
returns: summarizeOperationReturns(operation),
|
||||
omittedFromOverview: isRouteOmitted(method, apiPath),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
fs.writeFileSync(path.join(docsDir, 'routes.md'), renderRoutesOverview(operations));
|
||||
const overviewOperations = operations.filter((op) => !op.omittedFromOverview);
|
||||
fs.writeFileSync(path.join(docsDir, 'routes.md'), renderRoutesOverview(overviewOperations));
|
||||
fs.writeFileSync(path.join(docsDir, 'README.md'), renderReadme(operations));
|
||||
|
||||
console.log(`Wrote ${operations.length} route docs + routes.md → docs/api/`);
|
||||
console.log(`Wrote ${operations.length} route docs + ${overviewOperations.length} in routes.md → docs/api/`);
|
||||
|
||||
Reference in New Issue
Block a user