版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/eieiei438/article/details/81635115
Arvo的Scheme规范
语法格式
- JSON格式
支持的【简单】类型
- null------------no value
- boolean---------a binary value
- int ------------32 bit signed integer
- long------------64 bit signed integer
- float-----------single precision (32 bit)
- double----------double precision (64 bit)
- bytes-----------sequence of 8-bit unsigned bytes
- string----------unicode character sequence
支持的【复杂】类型
- records
- enums
- arrays
- maps
- unions
- fixed
例子
- 备注
- name---名称
- namespace---路径名称
- doc---文档注释
- aliases---别名
- fileds---包含项
- type---类型
- default---默认值
- symbols---枚举常量
序号 | 复杂类型 | 要求 | 例子 |
---|---|---|---|
1 | Records | "type":"record" 参数要求: 1、name【必须】 2、namespace 3、doc【可选】 4、aliases【可选】 5、fields【必须】 1、name【必须】 2、doc【可选】 3、type【必须】 4、default【可选】 |
{ "type": "record", "name": "LongList", "aliases": ["LinkedLongs"], fields" : [ {"name": "value", "type": "long"}, {"name": "next", "type": ["null", "LongList"]} ] } |
2 | Enums | "type":"enum" 参数要求: 1、name【必须】 2、namespace 3、doc【可选】 4、aliases【可选】 4、symbols【必须】 |
{ "type": "enum", "name": "Suit", "symbols" : ["SPADES", "HEARTS", "DIAMONDS", "CLUBS"] } |
3 | Arrays | "type":"array" 参数要求: 1、items【必须--写子项的类型】 |
{"type": "array", "items": "string"} |
4 | Maps | "type":"map" 参数要求: 1、values【必须--写子项的类型】 |
{"type": "map", "values": "long"} |
5 | Unions | 类型:JSON上数组【Unions不能包含多个相同类型的Schema,除非是命名的record类型、命名的fixed类型和命名的enum类型】 | ["null","string"] |
6 | Fixed | "type":"fixed" 参数要求: 1、name【必须】 2、namespace 3、size【必须】 4、aliases【可选】 |
{"type": "fixed", "size": 16, "name": "md5"} |