Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tqma113/jsoncall
A schema for description of json call.
https://github.com/tqma113/jsoncall
Last synced: 2 months ago
JSON representation
A schema for description of json call.
- Host: GitHub
- URL: https://github.com/tqma113/jsoncall
- Owner: tqma113
- License: mit
- Created: 2021-03-25T14:22:19.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-06-21T09:21:32.000Z (over 1 year ago)
- Last Synced: 2024-10-25T03:09:56.966Z (4 months ago)
- Language: TypeScript
- Homepage:
- Size: 557 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jsoncall
A schema for description of json call.
| | Express/Koa 等传统的 Web 框架 | GraphQL | Farrow | gRpc | JSONCall |
| ------------- | ----------------------------- | ------- | ------ | ---- | -------- |
| 类型安全 | ❌ | ❌ | ✅ | ❌ | ✅ |
| Validation | ❌ | ✅ | ✅ | | ✅ |
| 自定义类型 | ❌ | ✅ | ✅ | | ✅ |
| encode/decode | ❌ | ✅ | ❌ | | ✅ |
| schema | ❌ | ✅ | ✅ | | ✅ |
| 跨语言/平台 | ✅ | ✅ | ❌ | ✅ | ✅ |- 类型安全
- Type + Validation + encoder/decoder 一体化
- 代码生成:Schema <-> Server/Client Code,只需要定义一次,然后只需要关注/编写业务代码
- GraphQL 的 Schema overload 太多,一份类型模型要写 4 遍
- Farrow 只支持 TS 相关的内容,没有 encode/decode
- JSONCall 是底层实现无关的,可以是基于 HTTP 请求,可以是基于其他的 RPC 方案,甚至可以本地的函数调用,比如 TS 中调用 Rust 的函数
- TS 中调用 Rust 的函数,目前已有的方案非常麻烦,要自己做做很多的 validation、format、encode、decode,这个在 Native 和 webview 数据交互的 bridge 中有很大的应用空间
- 在序列化和反序列化的部分,因为我们有数据的 schema 所以可以通过 [fast-json-stringify](https://github.com/fastify/fast-json-stringify) 提升在序列化和反序列化的效率,也可以加入加密的部分