Skip to content

增加类型和字段检查并删除不需要的字段 #9

@fsy2001

Description

@fsy2001

现在部署时没有任何字段检查,应该加上类型严格检查,最好和生产代码一致,并顺便导出优化版的 JSON / TOML。

流程说明(以 Swift 为例):

  1. 执行 Python 脚本,将 TOML 转为 JSON(这一步已经写好了)
  2. 执行 Swift 程序,解码 JSON 为 struct 并重新编码为 JSON (这个过程会检查字段是否齐全,重新编码的过程会删掉没用的字段)
  3. 将重新编码的 JSON 导出为 swift.json

这样可以:

  1. 优化掉没用的字段,如 Swift 不看 stop_words,没必要传输
  2. 部署前检查字段齐全,不齐全就禁止部署,确保线上不会有问题。

@w568w Dart 可以做类似的操作吗?

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