connect icon indicating copy to clipboard operation
connect copied to clipboard

Fix schema registry encode's field "avro_raw_json"

Open ekeric13 opened this issue 3 years ago • 0 comments

Manually tested and it looks pretty good.

If the schema is:

{
  "type": "record",
  "name": "heartbeat_v3",
  "namespace": "outbox_events",
  "fields": [
      {
          "name": "heartbeat",
          "type": [
              "null",
              "int"
          ],
          "default": null
      }
  ]
}

When the benthos config is:

schema_registry_encode:
  url: ${SCHEMA_REGISTRY_ENDPOINT}
  subject: ${! meta("EventName")}
  avro_raw_json: false

If the input is:

'{"heartbeat": {"int": 1}}'

The logs show a success: Screen Shot 2022-08-10 at 5 35 41 AM

If the input is:

'{"heartbeat": 1}'

The logs show a failure: Screen Shot 2022-08-10 at 5 35 53 AM

When the benthos config is:

schema_registry_encode:
  url: ${SCHEMA_REGISTRY_ENDPOINT}
  subject: ${! meta("EventName")}
  avro_raw_json: true

If the input is:

'{"heartbeat": {"int": 1}}'

The logs show a failure: Screen Shot 2022-08-10 at 5 36 48 AM

If the input is:

'{"heartbeat": 1}'

The logs show a success: Screen Shot 2022-08-10 at 5 37 13 AM

ekeric13 avatar Aug 10 '22 11:08 ekeric13