Hello this is a follow up to #181
Since basic functionality now working, let me start from the beginning and provide more complicated examples.
Yet again I am comparing with similar functionality in AKHQ UI
Use case with errors
- The schema
{
"name": "CreateUserProfileWallet",
"namespace": "Messaging.Contracts.WalletManager.Commands",
"type": "record",
"fields": [
{ "name": "CurrencyCode", "type": "string" },
{ "name": "ExpiresOn", "type": ["null", "string"] }
]
}
- First JSON, where
ExpiresOn = null
{
"CurrencyCode": "EUR"
}
kaf invocation and the output
cat create.null.json | kaf produce --avro-schema-id 29 --input-mode full create_user_profile_wallet
Failed to encode avro
%!(EXTRA *errors.errorString=cannot decode textual record
"Messaging.Contracts.WalletManager.Commands.CreateUserProfileWallet": only found 1 of 2 fields)
- Second JSON, where
ExpiresOn != null
{
"CurrencyCode": "EUR",
"ExpiresOn": "2022-12-12"
}
kaf invocation and the output
cat create.json | kaf produce --avro-schema-id 29 --input-mode full create_user_profile_wallet
Failed to encode avro
%!(EXTRA *errors.errorString=cannot decode textual record
"Messaging.Contracts.WalletManager.Commands.CreateUserProfileWallet": cannot decode textual union: expected: '{'; actual: '"')
So, the messages are not working with kaf but those files are valid Avro JSON messages and can be sent to a topic using some other tools, e.g. AKHQ.
Existing solution
To overcome a problem - JSON files must be changed to some unfriendly format.
- First JSON, where
ExpiresOn == null
{
"CurrencyCode": "EUR",
"ExpiresOn": {
"null": null
}
}
- Second JSON, where
ExpiresOn != null
{
"CurrencyCode": "EUR",
"ExpiresOn": {
"string": "2022-12-12"
}
}
Improvement request
As a user I'd like kaf to be able to handle plain JSON (as described in the Use case section) for producing Avro encoded message. Without need to convert my plain JSON data to that weird format.
Currently this is working for some other tools, e.g. AKHQ UI, but it is missing for CLI based tools.
Hello this is a follow up to #181
Since basic functionality now working, let me start from the beginning and provide more complicated examples.
Yet again I am comparing with similar functionality in AKHQ UI
Use case with errors
{ "name": "CreateUserProfileWallet", "namespace": "Messaging.Contracts.WalletManager.Commands", "type": "record", "fields": [ { "name": "CurrencyCode", "type": "string" }, { "name": "ExpiresOn", "type": ["null", "string"] } ] }ExpiresOn= null{ "CurrencyCode": "EUR" }kafinvocation and the outputExpiresOn!= null{ "CurrencyCode": "EUR", "ExpiresOn": "2022-12-12" }kafinvocation and the outputSo, the messages are not working with
kafbut those files are valid Avro JSON messages and can be sent to a topic using some other tools, e.g. AKHQ.Existing solution
To overcome a problem - JSON files must be changed to some unfriendly format.
ExpiresOn== null{ "CurrencyCode": "EUR", "ExpiresOn": { "null": null } }ExpiresOn!= null{ "CurrencyCode": "EUR", "ExpiresOn": { "string": "2022-12-12" } }Improvement request
As a user I'd like
kafto be able to handle plain JSON (as described in the Use case section) for producing Avro encoded message. Without need to convert my plain JSON data to that weird format.Currently this is working for some other tools, e.g. AKHQ UI, but it is missing for CLI based tools.