schema_registry_client 0.0.9 → 0.0.11.pre.beta1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0919f12f0457fbdf7becd62389a7ed72e34afe9d7f3ce5c819f2e0ebf145174
4
- data.tar.gz: 4dc5c91669e508e89bc07763bebb6b754403ee72ccbe125ecfc888c48cf974fa
3
+ metadata.gz: 7aa1f66862cabf744233ac1fa0dcc199b7fbaaabb448d50f8e8b3aa0fb98f273
4
+ data.tar.gz: 642bfb50cd4efa20bdc93fb2740ed0ec6788866b378c7d601d5e7b05e8e6a9cf
5
5
  SHA512:
6
- metadata.gz: 07d614eaceb30420a69221399fab2e360f3f3b4089e5271b42fcaca30eb9f643cebcdd59187bdfc6a33d721641b960e2855fefce4703e59f455e459088bbd996
7
- data.tar.gz: 65a8cf4a6899e8f32febb2b408ebb20ed379224b7fbd0d716da33c6e0e6c10844559e5d4e1af73c3ee06a1601ecd0dc3853137aa3987837157bbd07c07655a21
6
+ metadata.gz: 58254805ac900a92e2b7e6418b1e1565dd2d23b257ce6c771d26a1e1dd753193de6836e417c5382c083d322ded4f0a67947898057e8656cf053f1d3b713d31b2
7
+ data.tar.gz: db29da6cc31f095f9f83d6c26b8b2de06a52d889d2ef1a445ba6861529f34014841dda8068cc26c2945dc016a08f884aebdd7c701ad0650f2feaf9bcb854d67b
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.9 - 2026-02-11
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- schema_registry_client (0.0.9)
4
+ schema_registry_client (0.0.11.pre.beta1)
5
5
  avro
6
6
  excon
7
7
  google-protobuf
@@ -24,6 +24,9 @@ module SchemaRegistry
24
24
  resolv_resolver: nil,
25
25
  retry_limit: nil
26
26
  )
27
+ if SchemaRegistry.debug
28
+ logger.info("Creating Confluent Schema Registry client with url: #{url}, schema_context: #{schema_context}, user: #{user}, path_prefix: #{path_prefix}")
29
+ end
27
30
  @path_prefix = path_prefix
28
31
  @schema_context_prefix = schema_context.nil? ? "" : ":.#{schema_context}:"
29
32
  @schema_context_options = schema_context.nil? ? {} : {query: {subject: @schema_context_prefix}}
@@ -73,11 +76,12 @@ module SchemaRegistry
73
76
  # @param references [Array<Hash>] optional references to other schemas
74
77
  # @return [Integer] the ID of the registered schema
75
78
  def register(subject, schema, references: [], schema_type: "PROTOBUF")
76
- body = {references: references,
77
- schema: schema.to_s}
79
+ puts("schema_type #{schema_type}")
80
+ body = {schema: schema.to_s}
78
81
  # Not all schema registry versions support schemaType
79
82
  if schema_type != "AVRO"
80
83
  body[:schemaType] = schema_type
84
+ body[:references] = references
81
85
  end
82
86
  data = post("/subjects/#{@schema_context_prefix}#{CGI.escapeURIComponent(subject)}/versions",
83
87
  body: body.to_json)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SchemaRegistry
4
- VERSION = "0.0.9"
4
+ VERSION = "0.0.11-beta1"
5
5
  end
@@ -14,6 +14,8 @@ module SchemaRegistry
14
14
 
15
15
  class << self
16
16
  attr_accessor :avro_schema_path
17
+
18
+ attr_accessor :debug
17
19
  end
18
20
 
19
21
  class Client
@@ -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: {"references" => [],
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: {"references" => [],
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: {"references" => [],
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: {"references" => [],
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"}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema_registry_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.11.pre.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Orner