feat: 完成P13治理收尾并创建P14执行合同(Issue: P13-1,P13-2,P13-3,P13-4,P13-5,P13-6,P13-7,P13-8,P14-0)

这个提交包含在:
2026-02-13 00:25:04 +08:00
父节点 3b221a2202
当前提交 1412fead5d
共修改 30 个文件,包含 3988 行新增和 105 行删除
+89
查看文件
@@ -0,0 +1,89 @@
const REQUEST_ID_SCHEMA = {
type: "string",
description: "服务端生成的请求追踪ID",
};
const ERROR_DETAILS_SCHEMA = {
type: "object",
additionalProperties: true,
};
const ERROR_BODY_SCHEMA = {
type: "object",
required: ["code", "message", "details"],
properties: {
code: { type: "string" },
message: { type: "string" },
details: ERROR_DETAILS_SCHEMA,
},
};
function buildDataEnvelopeSchema(dataSchema, description = "OK") {
return {
description,
type: "object",
required: ["requestId", "data"],
properties: {
requestId: REQUEST_ID_SCHEMA,
data: dataSchema,
},
};
}
function buildErrorEnvelopeSchema({
description = "业务错误",
codeExample = "VALID_001",
messageExample = "参数校验失败",
detailsExample,
} = {}) {
const schema = {
description,
type: "object",
required: ["requestId", "error"],
properties: {
requestId: REQUEST_ID_SCHEMA,
error: {
...ERROR_BODY_SCHEMA,
properties: {
...ERROR_BODY_SCHEMA.properties,
code: {
...ERROR_BODY_SCHEMA.properties.code,
example: codeExample,
},
message: {
...ERROR_BODY_SCHEMA.properties.message,
example: messageExample,
},
details: {
...ERROR_DETAILS_SCHEMA,
},
},
},
},
};
if (detailsExample !== undefined) {
schema.properties.error.properties.details.example = detailsExample;
}
return schema;
}
const UUID_PARAM_SCHEMA = {
type: "object",
required: ["id"],
properties: {
id: {
type: "string",
format: "uuid",
},
},
};
module.exports = {
REQUEST_ID_SCHEMA,
ERROR_BODY_SCHEMA,
buildDataEnvelopeSchema,
buildErrorEnvelopeSchema,
UUID_PARAM_SCHEMA,
};