文件操作 - boolean-parameter-prefixes.ts
返回文件管理
返回主菜单
删除本文件
文件: /var/www/OLD/node_modules/@redocly/openapi-core/src/rules/oas3/boolean-parameter-prefixes.ts
编辑文件内容
import type { Oas3Rule } from '../../visitors'; export type BooleanParameterPrefixesOptions = { prefixes?: string[]; }; export const BooleanParameterPrefixes: Oas3Rule = (options: BooleanParameterPrefixesOptions) => { const prefixes = options.prefixes || ['is', 'has']; const regexp = new RegExp(`^(${prefixes.join('|')})[A-Z-_]`); const wrappedPrefixes = prefixes.map((p) => `\`${p}\``); const prefixesString = wrappedPrefixes.length === 1 ? wrappedPrefixes[0] : wrappedPrefixes.slice(0, -1).join(', ') + ' or ' + wrappedPrefixes[prefixes.length - 1]; return { Parameter: { Schema(schema, { report, parentLocations }, parents) { if (schema.type === 'boolean' && !regexp.test(parents.Parameter.name)) { report({ message: `Boolean parameter \`${parents.Parameter.name}\` should have ${prefixesString} prefix.`, location: parentLocations.Parameter.child(['name']), }); } }, }, }; };
修改文件时间
将文件时间修改为当前时间的前一年
删除文件