- 重命名 ContentRules→ContentExpectations, KeyValueExpect→KeyedExpectations - 新增 Raw/Resolved 双层模型:resolve 阶段物化为执行计划,store 持久化 Raw 快照 - HTTP body 按需读取:status/headers 失败或无 body expectation 时不读取 body - 新增 displayValueExpectation() 解包 failure.expected 用户可读展示 - 修复 checkEarlyTimeout 独立 lte/lt 检查,修复 KeyedExpectations JSON Schema - 新增 expect/value.ts(resolve/check/display)、keyed.ts、content.ts、headers.ts、status.ts - 删除旧 normalize.ts/matcher.ts/validate-matcher.ts/key-value.ts - 更新 DEVELOPMENT.md:expect 五层管线表、displayValueExpectation、1.7↔1.10 交叉引用 - 同步 13 个 main specs,归档 refactor-expect-type-model 变更(62/62 tasks)
43 lines
1.6 KiB
TypeScript
43 lines
1.6 KiB
TypeScript
import { Type } from "@sinclair/typebox";
|
|
|
|
import type { CheckerSchemas } from "../types";
|
|
|
|
import {
|
|
createRawContentExpectationsSchema,
|
|
createRawValueExpectationSchema,
|
|
sizeSchema,
|
|
} from "../../schema/fragments";
|
|
|
|
export const udpCheckerSchemas: CheckerSchemas = {
|
|
config: Type.Object(
|
|
{
|
|
encoding: Type.Optional(Type.Union([Type.Literal("text"), Type.Literal("hex"), Type.Literal("base64")])),
|
|
host: Type.String({ minLength: 1 }),
|
|
maxResponseBytes: Type.Optional(sizeSchema),
|
|
payload: Type.Optional(Type.String()),
|
|
port: Type.Integer({ maximum: 65535, minimum: 1 }),
|
|
responseEncoding: Type.Optional(Type.Union([Type.Literal("text"), Type.Literal("hex"), Type.Literal("base64")])),
|
|
},
|
|
{ additionalProperties: false },
|
|
),
|
|
defaults: Type.Object(
|
|
{
|
|
encoding: Type.Optional(Type.Union([Type.Literal("text"), Type.Literal("hex"), Type.Literal("base64")])),
|
|
maxResponseBytes: Type.Optional(sizeSchema),
|
|
responseEncoding: Type.Optional(Type.Union([Type.Literal("text"), Type.Literal("hex"), Type.Literal("base64")])),
|
|
},
|
|
{ additionalProperties: false },
|
|
),
|
|
expect: Type.Object(
|
|
{
|
|
durationMs: Type.Optional(createRawValueExpectationSchema()),
|
|
responded: Type.Optional(Type.Boolean()),
|
|
response: Type.Optional(createRawContentExpectationsSchema()),
|
|
responseSize: Type.Optional(createRawValueExpectationSchema()),
|
|
sourceHost: Type.Optional(createRawValueExpectationSchema()),
|
|
sourcePort: Type.Optional(createRawValueExpectationSchema()),
|
|
},
|
|
{ additionalProperties: false },
|
|
),
|
|
};
|