Thanks to visit codestin.com
Credit goes to github.com

Skip to content

phrase entity type & custom type #71

@BBSQQ

Description

@BBSQQ

问题描述:

当前 phrase 区分 entity 和 custom,在使用过程中存在:

  • 用户需要感知明确 entity 和 custom 的区别,理解成本高;
  • custom 和 entity 的界限目前并不明确,通用的 custom 之后也可能转为 entity;
{
  type: 'entity',
  metadata: { entityType: 'metric_value' }
}
{
  type: 'custom',
  metadata: { customType: 'xxx' }
}

之前设计思路:

  • 短语分为三种:文本、entity、custom,entity 是内置的,要约束 metadata(但是当前看来也不能限制完全枚举 metadata,最好是扩展 key: string 只是默认内置插件不消费)
  • custom phrase 和 custom block 共用消费 CustomMeta 类型,且约束必须包括 customType key,所以存在 customType;

方案:

方案一:维持现状,提供 utils 默认转换归类内置的为 entity,其他的是 custom;
方案二:修改 phrase type 为 string,只是 text、内置 type 的区别,同时需要简化 plugin 的注册逻辑;

关于 metadata:

  • 需要支持 resource;
  • 扩展类型参数 [key: string]: any;

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions