You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,11 @@ All notable changes to this project will be documented in this file.
10
10
- New `mysql_cdc` input supporting change data capture (CDC) from MySQL. (@rockwotj, @le-vlad)
11
11
- Field `instance_id` added to `kafka`, `kafka_franz`, `ockam_kafka`, `redpanda`, `redpanda_common`, and `redpanda_migrator` inputs. (@rockwotj)
12
12
- Fields `rebalance_timeout`, `session_timeout` and `heartbeat_interval` added to the `kafka_franz`, `redpanda`, `redpanda_common`, `redpanda_migrator` and `ockam_kafka` inputs. (@rockwotj)
13
+
- Field `avro.preserve_logical_types` for processor `schema_registry_decode` was added to preserve logical types instead of decoding them as their primitive representation. (@rockwotj)
14
+
15
+
### Changed
16
+
17
+
- Field `avro_raw_json` was deprecated in favor of `avro.raw_unions` for processor `schema_registry_decode`. (@rockwotj)
Copy file name to clipboardExpand all lines: docs/modules/components/pages/processors/schema_registry_decode.adoc
+36-5Lines changed: 36 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,9 @@ Common::
36
36
# Common config fields, showing default values
37
37
label: ""
38
38
schema_registry_decode:
39
+
avro:
40
+
raw_unions: false # No default (optional)
41
+
preserve_logical_types: false
39
42
url: "" # No default (required)
40
43
```
41
44
@@ -48,7 +51,9 @@ Advanced::
48
51
# All config fields, showing default values
49
52
label: ""
50
53
schema_registry_decode:
51
-
avro_raw_json: false
54
+
avro:
55
+
raw_unions: false # No default (optional)
56
+
preserve_logical_types: false
52
57
url: "" # No default (required)
53
58
oauth:
54
59
enabled: false
@@ -91,8 +96,8 @@ This processor creates documents formatted as https://avro.apache.org/docs/curre
91
96
For example, the union schema `["null","string","Foo"]`, where `Foo` is a record name, would encode:
92
97
93
98
- `null` as `null`;
94
-
- the string `"a"` as `\{"string": "a"}`; and
95
-
- a `Foo` instance as `\{"Foo": {...}}`, where `{...}` indicates the JSON encoding of a `Foo` instance.
99
+
- the string `"a"` as `{"string": "a"}`; and
100
+
- a `Foo` instance as `{"Foo": {...}}`, where `{...}` indicates the JSON encoding of a `Foo` instance.
96
101
97
102
However, it is possible to instead create documents in https://pkg.go.dev/github.com/linkedin/goavro/v2#NewCodecForStandardJSONFull[standard/raw JSON format^] by setting the field <<avro_raw_json, `avro_raw_json`>> to `true`.
98
103
@@ -103,9 +108,35 @@ This processor decodes protobuf messages to JSON documents, you can read more ab
103
108
104
109
== Fields
105
110
106
-
=== `avro_raw_json`
111
+
=== `avro`
107
112
108
-
Whether Avro messages should be decoded into normal JSON ("json that meets the expectations of regular internet json") rather than https://avro.apache.org/docs/current/specification/_print/#json-encoding[Avro JSON^]. If `true` the schema returned from the subject should be decoded as https://pkg.go.dev/github.com/linkedin/goavro/v2#NewCodecForStandardJSONFull[standard json^] instead of as https://pkg.go.dev/github.com/linkedin/goavro/v2#NewCodec[avro json^]. There is a https://github.com/linkedin/goavro/blob/5ec5a5ee7ec82e16e6e2b438d610e1cab2588393/union.go#L224-L249[comment in goavro^], the https://github.com/linkedin/goavro[underlining library used for avro serialization^], that explains in more detail the difference between the standard json and avro json.
113
+
Configuration for how to decode schemas that are of type AVRO.
114
+
115
+
116
+
*Type*: `object`
117
+
118
+
119
+
=== `avro.raw_unions`
120
+
121
+
Whether avro messages should be decoded into normal JSON ("json that meets the expectations of regular internet json") rather than https://avro.apache.org/docs/current/specification/_print/#json-encoding[JSON as specified in the Avro Spec^].
122
+
123
+
For example, if there is a union schema `["null", "string", "Foo"]` where `Foo` is a record name, with raw_unions as false (the default) you get:
124
+
- `null` as `null`;
125
+
- the string `"a"` as `{"string": "a"}`; and
126
+
- a `Foo` instance as `{"Foo": {...}}`, where `{...}` indicates the JSON encoding of a `Foo` instance.
127
+
128
+
When raw_unions is set to true then the above union schema is decoded as the following:
129
+
- `null` as `null`;
130
+
- the string `"a"` as `"a"`; and
131
+
- a `Foo` instance as `{...}`, where `{...}` indicates the JSON encoding of a `Foo` instance.
132
+
133
+
134
+
*Type*: `bool`
135
+
136
+
137
+
=== `avro.preserve_logical_types`
138
+
139
+
Whether logical types should be preserved or transformed back into their primitive type. By default, decimals are decoded as raw bytes and timestamps are decoded as plain integers. Setting this field to true keeps decimal types as numbers in bloblang and timestamps as time values.
Copy file name to clipboardExpand all lines: internal/impl/confluent/processor_schema_registry_decode.go
+55-14Lines changed: 55 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -52,8 +52,8 @@ This processor creates documents formatted as https://avro.apache.org/docs/curre
52
52
For example, the union schema `+"`[\"null\",\"string\",\"Foo\"]`, where `Foo`"+` is a record name, would encode:
53
53
54
54
- `+"`null` as `null`"+`;
55
-
- the string `+"`\"a\"` as `\\{\"string\": \"a\"}`"+`; and
56
-
- a `+"`Foo` instance as `\\{\"Foo\": {...}}`, where `{...}` indicates the JSON encoding of a `Foo`"+` instance.
55
+
- the string `+"`\"a\"` as `{\"string\": \"a\"}`"+`; and
56
+
- a `+"`Foo` instance as `{\"Foo\": {...}}`, where `{...}` indicates the JSON encoding of a `Foo`"+` instance.
57
57
58
58
However, it is possible to instead create documents in https://pkg.go.dev/github.com/linkedin/goavro/v2#NewCodecForStandardJSONFull[standard/raw JSON format^] by setting the field `+"<<avro_raw_json, `avro_raw_json`>> to `true`"+`.
59
59
@@ -63,7 +63,25 @@ This processor decodes protobuf messages to JSON documents, you can read more ab
63
63
`).
64
64
Field(service.NewBoolField("avro_raw_json").
65
65
Description("Whether Avro messages should be decoded into normal JSON (\"json that meets the expectations of regular internet json\") rather than https://avro.apache.org/docs/current/specification/_print/#json-encoding[Avro JSON^]. If `true` the schema returned from the subject should be decoded as https://pkg.go.dev/github.com/linkedin/goavro/v2#NewCodecForStandardJSONFull[standard json^] instead of as https://pkg.go.dev/github.com/linkedin/goavro/v2#NewCodec[avro json^]. There is a https://github.com/linkedin/goavro/blob/5ec5a5ee7ec82e16e6e2b438d610e1cab2588393/union.go#L224-L249[comment in goavro^], the https://github.com/linkedin/goavro[underlining library used for avro serialization^], that explains in more detail the difference between the standard json and avro json.").
66
-
Advanced().Default(false)).
66
+
Advanced().Default(false).Deprecated()).
67
+
Fields(
68
+
service.NewObjectField(
69
+
"avro",
70
+
service.NewBoolField("raw_unions").Description(`Whether avro messages should be decoded into normal JSON ("json that meets the expectations of regular internet json") rather than https://avro.apache.org/docs/current/specification/_print/#json-encoding[JSON as specified in the Avro Spec^].
71
+
72
+
For example, if there is a union schema `+"`"+`["null", "string", "Foo"]`+"`"+` where `+"`Foo`"+` is a record name, with raw_unions as false (the default) you get:
73
+
- `+"`null` as `null`"+`;
74
+
- the string `+"`\"a\"` as `{\"string\": \"a\"}`"+`; and
75
+
- a `+"`Foo` instance as `{\"Foo\": {...}}`, where `{...}` indicates the JSON encoding of a `Foo`"+` instance.
76
+
77
+
When raw_unions is set to true then the above union schema is decoded as the following:
78
+
- `+"`null` as `null`"+`;
79
+
- the string `+"`\"a\"` as `\"a\"`"+`; and
80
+
- a `+"`Foo` instance as `{...}`, where `{...}` indicates the JSON encoding of a `Foo`"+` instance.
81
+
`).Optional(),
82
+
service.NewBoolField("preserve_logical_types").Description(`Whether logical types should be preserved or transformed back into their primitive type. By default, decimals are decoded as raw bytes and timestamps are decoded as plain integers. Setting this field to true keeps decimal types as numbers in bloblang and timestamps as time values.`).Default(false),
83
+
).Description("Configuration for how to decode schemas that are of type AVRO."),
84
+
).
67
85
Field(service.NewURLField("url").Description("The base URL of the schema registry service."))
0 commit comments