文件操作 - no-identical-paths.ts
返回文件管理
返回主菜单
删除本文件
文件: /var/www/OLD/node_modules/@redocly/openapi-core/src/rules/common/no-identical-paths.ts
编辑文件内容
import type { Oas3Rule, Oas2Rule } from '../../visitors'; import type { UserContext } from '../../walk'; import type { Oas3Paths } from '../../typings/openapi'; import type { Oas2Paths } from '../../typings/swagger'; export const NoIdenticalPaths: Oas3Rule | Oas2Rule = () => { return { Paths(pathMap: Oas3Paths | Oas2Paths, { report, location }: UserContext) { const Paths = new Map<string, string>(); for (const pathName of Object.keys(pathMap)) { const id = pathName.replace(/{.+?}/g, '{VARIABLE}'); const existingSamePath = Paths.get(id); if (existingSamePath) { report({ message: `The path already exists which differs only by path parameter name(s): \`${existingSamePath}\` and \`${pathName}\`.`, location: location.child([pathName]).key(), }); } else { Paths.set(id, pathName); } } }, }; };
修改文件时间
将文件时间修改为当前时间的前一年
删除文件