schema_registry_client 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -2
- data/Gemfile.lock +1 -1
- data/lib/schema_registry_client/confluent_schema_registry.rb +3 -2
- data/lib/schema_registry_client/version.rb +1 -1
- data/spec/encoding_spec.rb +4 -8
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d3b14147c915a8acf65e41b25d76d5dd1c8216ac93d0bb493b8585459c191dde
|
|
4
|
+
data.tar.gz: d96ab79b926b29316d79bdba4dea5fc6676a5da8032a279ceb1cf18cf52ee7a6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5239758e46fb68da608d5bafd6947384d4849cce7db3e9cfb55e327b35caaf44fdf30238fb66ffbee2d4277eedbea236528c29549083d7a2c5272359d68f65c7
|
|
7
|
+
data.tar.gz: 0c2debfe3b410f38366058a8fa5905f1a22e21e6433e1a555c15465bf171ddb989641428edfc699e68c3137845e36eff1eb9245c82cde3a266b76eeb0fe60f20
|
data/CHANGELOG.md
CHANGED
|
@@ -7,9 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## UNRELEASED
|
|
9
9
|
|
|
10
|
-
# 0.0.
|
|
10
|
+
# 0.0.10 - 2026-02-11
|
|
11
11
|
|
|
12
|
-
* Fix: Do not send `schemaType` if schema type is `AVRO`, for backwards compatibility with older schema registries.
|
|
12
|
+
* Fix: Do not send `schemaType` or `references` if schema type is `AVRO`, for backwards compatibility with older schema registries.
|
|
13
13
|
|
|
14
14
|
# 0.0.8 - 2026-02-04
|
|
15
15
|
|
data/Gemfile.lock
CHANGED
|
@@ -73,11 +73,12 @@ module SchemaRegistry
|
|
|
73
73
|
# @param references [Array<Hash>] optional references to other schemas
|
|
74
74
|
# @return [Integer] the ID of the registered schema
|
|
75
75
|
def register(subject, schema, references: [], schema_type: "PROTOBUF")
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
puts("schema_type #{schema_type}")
|
|
77
|
+
body = {schema: schema.to_s}
|
|
78
78
|
# Not all schema registry versions support schemaType
|
|
79
79
|
if schema_type != "AVRO"
|
|
80
80
|
body[:schemaType] = schema_type
|
|
81
|
+
body[:references] = references
|
|
81
82
|
end
|
|
82
83
|
data = post("/subjects/#{@schema_context_prefix}#{CGI.escapeURIComponent(subject)}/versions",
|
|
83
84
|
body: body.to_json)
|
data/spec/encoding_spec.rb
CHANGED
|
@@ -117,8 +117,7 @@ RSpec.describe "encoding" do
|
|
|
117
117
|
it "should encode a simple message" do
|
|
118
118
|
schema = File.read("#{__dir__}/schemas/simple/v1/SimpleMessage.avsc")
|
|
119
119
|
stub = stub_request(:post, "http://localhost:8081/subjects/simple/versions")
|
|
120
|
-
.with(body: {"
|
|
121
|
-
"schema" => schema}).to_return_json(body: {id: 15})
|
|
120
|
+
.with(body: {"schema" => schema}).to_return_json(body: {id: 15})
|
|
122
121
|
msg = {"name" => "my name"}
|
|
123
122
|
encoded = schema_registry_client.encode(msg, subject: "simple", schema_name: "simple.v1.SimpleMessage")
|
|
124
123
|
# Avro encoding: magic byte (0x00) + schema id (4 bytes, big-endian) + Avro binary data
|
|
@@ -135,8 +134,7 @@ RSpec.describe "encoding" do
|
|
|
135
134
|
it "should encode a complex message with nested record" do
|
|
136
135
|
schema = File.read("#{__dir__}/schemas/referenced/v1/MessageBA.avsc")
|
|
137
136
|
stub = stub_request(:post, "http://localhost:8081/subjects/referenced/versions")
|
|
138
|
-
.with(body: {"
|
|
139
|
-
"schema" => schema}).to_return_json(body: {id: 20})
|
|
137
|
+
.with(body: {"schema" => schema}).to_return_json(body: {id: 20})
|
|
140
138
|
msg = {
|
|
141
139
|
"simple" => {
|
|
142
140
|
"name" => "my name"
|
|
@@ -170,8 +168,7 @@ RSpec.describe "encoding" do
|
|
|
170
168
|
File.write("#{multi_schema_path}/MultiFieldMessage.avsc", schema_json)
|
|
171
169
|
|
|
172
170
|
stub = stub_request(:post, "http://localhost:8081/subjects/multi/versions")
|
|
173
|
-
.with(body: {"
|
|
174
|
-
"schema" => schema_json}).to_return_json(body: {id: 25})
|
|
171
|
+
.with(body: {"schema" => schema_json}).to_return_json(body: {id: 25})
|
|
175
172
|
|
|
176
173
|
msg = {"name" => "Alice", "age" => 30}
|
|
177
174
|
encoded = schema_registry_client.encode(msg, subject: "multi", schema_name: "test.v1.MultiFieldMessage")
|
|
@@ -189,8 +186,7 @@ RSpec.describe "encoding" do
|
|
|
189
186
|
it "should validate schema before encoding" do
|
|
190
187
|
schema = File.read("#{__dir__}/schemas/simple/v1/SimpleMessage.avsc")
|
|
191
188
|
stub_request(:post, "http://localhost:8081/subjects/simple/versions")
|
|
192
|
-
.with(body: {"
|
|
193
|
-
"schema" => schema}).to_return_json(body: {id: 15})
|
|
189
|
+
.with(body: {"schema" => schema}).to_return_json(body: {id: 15})
|
|
194
190
|
|
|
195
191
|
# Invalid message - missing required field
|
|
196
192
|
msg = {"invalid_field" => "value"}
|