我有一个带有此属性的Avro架构:
{"name": "whenDate", "type": ["date", "null"]}
我正在使用Python客户端和生产者
confluent_kafka.avro.AvroProducer
当我使用上述属性加载Avro架构时, 我触发了这个错误:
not a valid Avro schema: Type property "[u'date', u'null']" not a valid
Avro schema: Union item must be a valid Avro schema: Could not make an Avro Schema object from date.
我认为此错误说明了Avro架构的Confluent解析器中的限制。也就是说,date
是指定为here的逻辑类型,但Confluent解析器尚未支持它。
任何人都可以确认吗?更一般地说,我应该假设Confluent解析器不处理Avro架构的逻辑类型吗?感谢。
答案 0 :(得分:1)
这是一种逻辑类型,我认为你只需要将它声明为一个。
var app = {};
app.character = (function() {
// the character manipulation object
// this will be used to create character objects
function _createCharacter(name) {
return {
// Just an example
name: name,
stats: { health: 10, level: 1 },
weapon: {}
};
}
return {
createCharacter: _createCharacter
};
})();
app.items = {};
app.items.gear = (function() {
// the gear manipulation object
// this will be used to create gear objects
function _createGear() {
return {
name: 'Sword',
mods: { damage: 3, strength: 1 } // In reality it's random
};
}
return {
createGear: _createGear
};
})();
app.game = (function() {
var _player = {};
//this.character = character;
// closed functions in this area
function _giveWeapon() {
_player.weapon = app.items.gear.createGear();
}
function _newPlayer(name) {
//_player = this.character.createCharacter(name);
_player = app.character.createCharacter(name);
_giveWeapon();
}
function _getPlayer() {
return _player;
}
return {
getPlayer: _getPlayer,
newPlayer: _newPlayer
};
})();
app.game.newPlayer('Ryan');
console.log(app.game.getPlayer());