avromatic 0.14.0 → 0.15.0.rc0
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 935170792357d999c9d6a98f815245d6444ea575
|
4
|
+
data.tar.gz: a6e2ebefd9798759d134b7e28ee74c518c504683
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c859d6d1487f231a09fb13e5eefb5c9c4c4c43d75acd9f70f45139270988ae99fb543f8bc9dd89a45fc9600e092b4827bc872ac1d4ae557e7b85e7ee1ffedf61
|
7
|
+
data.tar.gz: 4eb618843588851496fec520d0265b68b8a230d9d01c3eeb27a71577335338d3b9b6b545596a48992650a194e3b2ff5e24259b465867cad30b7b058359d69206
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# avromatic changelog
|
2
2
|
|
3
|
+
## v0.15.0
|
4
|
+
- Add patch to `AvroTurf::SchemaRegistry` to lookup existing schema ids using
|
5
|
+
`GET /subjects/:subject/fingerprints/:fingerprint` from `#register`.
|
6
|
+
This endpoint is supported in the avro-schema-registry.
|
7
|
+
- Add patch to the `FakeSchemaRegistryServer` from `AvroTurf` to support the
|
8
|
+
fingerprint endpoint.
|
9
|
+
|
3
10
|
## v0.14.0
|
4
11
|
- Add `Avromatic::Messaging` and `Avromatic::IO::DatumReader` classes to
|
5
12
|
optimize the decoding of Avro unions to Avromatic models.
|
data/lib/avromatic/rspec.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'avro_turf'
|
2
|
+
require 'avro_turf/schema_registry'
|
3
|
+
|
4
|
+
AvroTurf::SchemaRegistry.class_eval do
|
5
|
+
# Override register to first check if a schema is registered by fingerprint
|
6
|
+
def register(subject, schema)
|
7
|
+
schema_object = if schema.is_a?(String)
|
8
|
+
Avro::Schema.parse(schema)
|
9
|
+
else
|
10
|
+
schema
|
11
|
+
end
|
12
|
+
|
13
|
+
registered = false
|
14
|
+
data = begin
|
15
|
+
get("/subjects/#{subject}/fingerprints/#{schema_object.sha256_fingerprint.to_s(16)}")
|
16
|
+
rescue
|
17
|
+
registered = true
|
18
|
+
post("/subjects/#{subject}/versions", body: { schema: schema.to_s }.to_json)
|
19
|
+
end
|
20
|
+
|
21
|
+
id = data.fetch('id')
|
22
|
+
|
23
|
+
@logger.info("#{registered ? 'Registered' : 'Found'} schema for subject `#{subject}`; id = #{id}")
|
24
|
+
|
25
|
+
id
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'avro_turf/test/fake_schema_registry_server'
|
2
|
+
|
3
|
+
# Add support for endpoint to lookup subject schema id by fingerprint.
|
4
|
+
FakeSchemaRegistryServer.class_eval do
|
5
|
+
SCHEMA_NOT_FOUND = FakeSchemaRegistryServer::SCHEMA_NOT_FOUND
|
6
|
+
SCHEMAS = FakeSchemaRegistryServer::SCHEMAS
|
7
|
+
SUBJECTS = FakeSchemaRegistryServer::SUBJECTS
|
8
|
+
|
9
|
+
get '/subjects/:subject/fingerprints/:fingerprint' do
|
10
|
+
subject = params[:subject]
|
11
|
+
halt(404, SCHEMA_NOT_FOUND) unless SUBJECTS.key?(subject)
|
12
|
+
|
13
|
+
fingerprint = params[:fingerprint]
|
14
|
+
fingerprint = fingerprint.to_i.to_s(16) if /^\d+$/ =~ fingerprint
|
15
|
+
|
16
|
+
schema_id = SCHEMAS.find_index do |schema|
|
17
|
+
Avro::Schema.parse(schema).sha256_fingerprint.to_s(16) == fingerprint
|
18
|
+
end
|
19
|
+
|
20
|
+
halt(404, SCHEMA_NOT_FOUND) unless schema_id && SUBJECTS[subject].include?(schema_id)
|
21
|
+
|
22
|
+
{ id: schema_id }.to_json
|
23
|
+
end
|
24
|
+
end
|
data/lib/avromatic/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avromatic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0.rc0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Salsify Engineering
|
@@ -272,6 +272,8 @@ files:
|
|
272
272
|
- lib/avromatic/model_registry.rb
|
273
273
|
- lib/avromatic/railtie.rb
|
274
274
|
- lib/avromatic/rspec.rb
|
275
|
+
- lib/avromatic/schema_registry_patch.rb
|
276
|
+
- lib/avromatic/test/fake_schema_registry_server.rb
|
275
277
|
- lib/avromatic/version.rb
|
276
278
|
- log/.gitkeep
|
277
279
|
homepage: https://github.com/salsify/avromatic.git
|
@@ -289,9 +291,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
289
291
|
version: '0'
|
290
292
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
291
293
|
requirements:
|
292
|
-
- - "
|
294
|
+
- - ">"
|
293
295
|
- !ruby/object:Gem::Version
|
294
|
-
version:
|
296
|
+
version: 1.3.1
|
295
297
|
requirements: []
|
296
298
|
rubyforge_project:
|
297
299
|
rubygems_version: 2.6.8
|