From 94997df8421525cec963443b41a6d9e2b9f55e54 Mon Sep 17 00:00:00 2001 From: "huyikun.hyk" Date: Thu, 1 Feb 2024 15:06:09 +0800 Subject: [PATCH] update: schema rules Signed-off-by: huyikun.hyk --- packages/registry/package.json | 2 +- packages/registry/src/actions/constant.ts | 38 ++++++++++++----------- packages/registry/src/actions/package.ts | 6 ++-- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/packages/registry/package.json b/packages/registry/package.json index 40d80bf9..fbee8eab 100644 --- a/packages/registry/package.json +++ b/packages/registry/package.json @@ -1,6 +1,6 @@ { "name": "@serverless-devs/registry", - "version": "0.0.6", + "version": "0.0.7-beta.3", "description": "request for serverless-devs", "main": "lib/index.js", "scripts": { diff --git a/packages/registry/src/actions/constant.ts b/packages/registry/src/actions/constant.ts index ec9864ff..a96ef39c 100644 --- a/packages/registry/src/actions/constant.ts +++ b/packages/registry/src/actions/constant.ts @@ -12,7 +12,7 @@ export const publishSchema = { "Category", "Service", // "Commands", - "Organization", + // "Organization", "Effective", "Parameters" ], @@ -108,23 +108,25 @@ export const publishSchema = { }, "Service": { "type": "object", - "patternProperties": { - "^(函数计算|对象存储|内容分发网络|资源编排|硬盘挂载|专有网络|日志服务|容器镜像服务|事件总线|表格存储|Serverless应用引擎|云数据库RDS MySQL 版|视频点播|智能媒体服务|媒体处理|低代码音视频工厂|音视频通信|其它|FC|OSS|CDN|ROS|NAS|VPC|SLS|CR|EventBridge|Tablestore|SAE|RDS MySQL|VOD|ICE|MTS|IMP|RTC|Other)$": { - "type": "object", - "properties": { - "Authorities": { - "type": "array", - "items": { - "type": "string" - } - }, - "Runtime": { - "type": "string" - } - }, - "required": ["Authorities"] - } - }, + // schema 提示不友好,依赖后端错误返回结果 + // "patternProperties": { + // "^(函数计算|对象存储|内容分发网络|资源编排|硬盘挂载|专有网络|日志服务|容器镜像服务|事件总线|表格存储|Serverless应用引擎|云数据库RDS MySQL 版|视频点播|智能媒体服务|媒体处理|低代码音视频工厂|音视频通信|其它|FC|OSS|CDN|ROS|NAS|VPC|SLS|CR|EventBridge|Tablestore|SAE|RDS MySQL|VOD|ICE|MTS|IMP|RTC|Other)$": { + // "type": "object", + // "properties": { + // "Authorities": { + // "type": "array", + // "items": { + // "type": "string" + // } + // }, + // "Runtime": { + // "type": "string" + // } + // }, + // "required": ["Authorities"] + // } + // }, + // "additionalProperties": false }, "Organization": { "type": "string" diff --git a/packages/registry/src/actions/package.ts b/packages/registry/src/actions/package.ts index a9c2d63a..5878308c 100644 --- a/packages/registry/src/actions/package.ts +++ b/packages/registry/src/actions/package.ts @@ -104,9 +104,9 @@ async function getUploadUrl(codeUri: string): Promise { const yamlObject = yaml.load(publishYaml) as Record; const errorMsg = `Publish.yaml illegal. - 应用开发示例: https://docs.serverless-devs.com/serverless-devs/development-manual/readme#%E5%BA%94%E7%94%A8%E6%A8%A1%E5%9E%8B%E5%85%83%E6%95%B0%E6%8D%AE - 组件开发示例: https://docs.serverless-devs.com/serverless-devs/development-manual/component#%E7%BB%84%E4%BB%B6%E6%A8%A1%E5%9E%8B%E5%85%83%E6%95%B0%E6%8D%AE - 插件开发示例: https://docs.serverless-devs.com/serverless-devs/development-manual/plugin#%E6%8F%92%E4%BB%B6%E6%A8%A1%E5%9E%8B%E5%85%83%E6%95%B0%E6%8D%AE + Application dev: https://docs.serverless-devs.com/serverless-devs/development-manual/readme + Component dev: https://docs.serverless-devs.com/serverless-devs/development-manual/component + Plugin dev: https://docs.serverless-devs.com/serverless-devs/development-manual/plugin ` const ajv = new Ajv({ allErrors: true }); const validate = ajv.compile(publishSchema);