文件操作 - response-contains-property.ts
返回文件管理
返回主菜单
删除本文件
文件: /var/www/OLD/node_modules/@redocly/openapi-core/src/rules/oas3/response-contains-property.ts
编辑文件内容
import { getMatchingStatusCodeRange } from '../../utils'; import type { Oas3Rule } from '../../visitors'; import type { UserContext } from '../../walk'; export const ResponseContainsProperty: Oas3Rule = (options) => { const names: Record<string, string[]> = options.names || {}; let key: string | number; return { Operation: { Response: { skip: (_response, key) => { return `${key}` === '204'; }, enter: (_response, ctx: UserContext) => { key = ctx.key; }, MediaType: { Schema(schema, { report, location }) { if (schema.type !== 'object') return; const expectedProperties = names[key] || names[getMatchingStatusCodeRange(key)] || names[getMatchingStatusCodeRange(key).toLowerCase()] || []; for (const expectedProperty of expectedProperties) { if (!schema.properties?.[expectedProperty]) { report({ message: `Response object must contain a top-level "${expectedProperty}" property.`, location: location.child('properties').key(), }); } } }, }, }, }, }; };
修改文件时间
将文件时间修改为当前时间的前一年
删除文件