Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update: schema rules #32

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/registry/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
38 changes: 20 additions & 18 deletions packages/registry/src/actions/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const publishSchema = {
"Category",
"Service",
// "Commands",
"Organization",
// "Organization",
"Effective",
"Parameters"
],
Expand Down Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions packages/registry/src/actions/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ async function getUploadUrl(codeUri: string): Promise<string> {

const yamlObject = yaml.load(publishYaml) as Record<string, any>;
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);
Expand Down
Loading