文件操作 - path-excludes-patterns.ts
返回文件管理
返回主菜单
删除本文件
文件: /var/www/OLD/node_modules/@redocly/openapi-core/src/rules/common/path-excludes-patterns.ts
编辑文件内容
import type { Oas2Rule, Oas3Rule } from '../../visitors'; import type { Oas2PathItem } from '../../typings/swagger'; import type { Oas3PathItem } from '../../typings/openapi'; import type { UserContext } from '../../walk'; export const PathExcludesPatterns: Oas3Rule | Oas2Rule = ({ patterns }) => { return { PathItem(_path: Oas2PathItem | Oas3PathItem, { report, key, location }: UserContext) { if (!patterns) throw new Error(`Parameter "patterns" is not provided for "path-excludes-patterns" rule`); const pathKey = key.toString(); if (pathKey.startsWith('/')) { const matches = patterns.filter((pattern: string) => pathKey.match(pattern)); for (const match of matches) { report({ message: `path \`${pathKey}\` should not match regex pattern: \`${match}\``, location: location.key(), }); } } }, }; };
修改文件时间
将文件时间修改为当前时间的前一年
删除文件