制作一个简单的 apache avro 模式 API
Make apache avro schema of a simple API
我想在 Apache Avro 中创建一个简单的 API 模式,但问题是我的 API 有 header 字段 "Content-Type",而 Avro 不允许“- “名义上。
这是我的 JSON:
"headers": {"Content-Type": "application/x-www-form-urlencoded"}
这是架构示例:
{
"name": "headers",
"type": {
"type": "record",
"name": "headers",
"fields": [
{ "name": "Content-type", "type": ["string", "null"] }
]
}
},
使用 Avro map 代替记录表示 headers:
{
"name": "headers",
"type": {
"type": "map",
"values": "string"
}
},
我想在 Apache Avro 中创建一个简单的 API 模式,但问题是我的 API 有 header 字段 "Content-Type",而 Avro 不允许“- “名义上。 这是我的 JSON:
"headers": {"Content-Type": "application/x-www-form-urlencoded"}
这是架构示例:
{
"name": "headers",
"type": {
"type": "record",
"name": "headers",
"fields": [
{ "name": "Content-type", "type": ["string", "null"] }
]
}
},
使用 Avro map 代替记录表示 headers:
{
"name": "headers",
"type": {
"type": "map",
"values": "string"
}
},