文件操作 - info-description-override.ts
返回文件管理
返回主菜单
删除本文件
文件: /var/www/OLD/node_modules/@redocly/openapi-core/src/decorators/common/info-description-override.ts
编辑文件内容
import { readFileAsStringSync } from '../../utils'; import type { Oas3Decorator, Oas2Decorator } from '../../visitors'; import type { UserContext } from '../../walk'; export const InfoDescriptionOverride: Oas3Decorator | Oas2Decorator = ({ filePath }) => { return { Info: { leave(info, { report, location }: UserContext) { if (!filePath) throw new Error( `Parameter "filePath" is not provided for "info-description-override" rule` ); try { info.description = readFileAsStringSync(filePath); } catch (e) { report({ message: `Failed to read markdown override file for "info.description".\n${e.message}`, location: location.child('description'), }); } }, }, }; };
修改文件时间
将文件时间修改为当前时间的前一年
删除文件