avromatic 0.14.0.rc1 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7369434a4b68c8365b25ad81d40ce9ec76fd7484
4
- data.tar.gz: 220cb9380ed3fea70528591faf86119f2f6fd3bd
3
+ metadata.gz: 81c34321b541cd5f890615b13b5d61b59b27a8a5
4
+ data.tar.gz: 0bb1ccc7add9573f0dd92433fcf64badc9eb1f28
5
5
  SHA512:
6
- metadata.gz: cdd4caca1a44832a744471335eb7bc8d4a3efde58e8dbe530fd41214cfe364d3ecc957841eb5a1c29b3672b3d53d498d6f5d3b8bd7f6523b53f9b34f5bc32ee3
7
- data.tar.gz: 0ce98e336ee84b470c5f65b8caa5ab466589a33f683c63cb009b8b974f2c65196280e273b0796605a42413593b4ef38b245a6148098fb5a0ab8ce9ae501ff361
6
+ metadata.gz: 99f92368cee3ad3dd2bf300929e691239bbb8b923530ac8ee883b7732dcf0078b96be4ded276744e17409b705f4b452d9d0e1effad1b19104a41f8360145278b
7
+ data.tar.gz: 99d8b4e28ed8e8a8aa5af87ad0ca60487f2d3437047b2e3133909ff72e24cc536719dce9f258451e37a53d359f8c55c3a6cd2ed99d3c892fcebbe780ceca45c1
data/Appraisals CHANGED
@@ -1,17 +1,17 @@
1
1
  appraise 'rails4_1' do
2
2
  gem 'avro', '1.8.1'
3
- gem 'activesupport', '~> 4.1.15'
4
- gem 'activemodel', '~> 4.1.15'
3
+ gem 'activesupport', '~> 4.1.16'
4
+ gem 'activemodel', '~> 4.1.16'
5
5
  end
6
6
 
7
7
  appraise 'rails4_2' do
8
8
  gem 'avro', '1.8.1'
9
- gem 'activesupport', '~> 4.2.6'
10
- gem 'activemodel', '~> 4.2.6'
9
+ gem 'activesupport', '~> 4.2.7.1'
10
+ gem 'activemodel', '~> 4.2.7.1'
11
11
  end
12
12
 
13
13
  appraise 'avro-salsify-fork' do
14
- gem 'avro-salsify-fork', '1.9.0.1', require: 'avro'
15
- gem 'activesupport', '~> 4.2.6'
16
- gem 'activemodel', '~> 4.2.6'
14
+ gem 'avro-salsify-fork', '1.9.0.3', require: 'avro'
15
+ gem 'activesupport', '~> 4.2.7.1'
16
+ gem 'activemodel', '~> 4.2.7.1'
17
17
  end
data/README.md CHANGED
@@ -59,8 +59,8 @@ and the [Messaging API](#messaging-api).
59
59
  * **registry_url**: URL for the schema registry. Either `schema_registry` or
60
60
  `registry_url` must be configured.
61
61
  * **messaging**: An `AvroTurf::Messaging` object to be shared by all generated models.
62
- The `build_messaging!` method may be used to create a `Messaging` instance based
63
- on the other configuration values.
62
+ The `build_messaging!` method may be used to create a `Avromatic::Messaging`
63
+ instance based on the other configuration values.
64
64
  * **logger**: The logger to use for the schema registry client.
65
65
  * [Custom Types](#custom-types)
66
66
 
@@ -74,6 +74,15 @@ Avromatic.configure do |config|
74
74
  end
75
75
  ```
76
76
 
77
+ #### Decoding
78
+
79
+ * **use_custom_datum_reader**: `Avromatic` includes a modified subclass of
80
+ `Avro::IO::DatumReader`. This subclass returns additional information about
81
+ the index of union members when decoding Avro messages. This information is
82
+ used to optimize model creation when decoding. By default this information
83
+ is included in the hash returned by the `DatumReader` but can be omitted by
84
+ setting this option to `false`.
85
+
77
86
  ### Models
78
87
 
79
88
  Models are defined based on an Avro schema for a record.
@@ -2,8 +2,8 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "avro-salsify-fork", "1.9.0.1", :require => "avro"
6
- gem "activesupport", "~> 4.2.6"
7
- gem "activemodel", "~> 4.2.6"
5
+ gem "avro-salsify-fork", "1.9.0.3", :require => "avro"
6
+ gem "activesupport", "~> 4.2.7.1"
7
+ gem "activemodel", "~> 4.2.7.1"
8
8
 
9
9
  gemspec :path => "../"
@@ -3,7 +3,7 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "avro", "1.8.1"
6
- gem "activesupport", "~> 4.1.15"
7
- gem "activemodel", "~> 4.1.15"
6
+ gem "activesupport", "~> 4.1.16"
7
+ gem "activemodel", "~> 4.1.16"
8
8
 
9
9
  gemspec :path => "../"
@@ -3,7 +3,7 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "avro", "1.8.1"
6
- gem "activesupport", "~> 4.2.6"
7
- gem "activemodel", "~> 4.2.6"
6
+ gem "activesupport", "~> 4.2.7.1"
7
+ gem "activemodel", "~> 4.2.7.1"
8
8
 
9
9
  gemspec :path => "../"
@@ -2,7 +2,8 @@
2
2
  module Avromatic
3
3
  module IO
4
4
  # Subclass DatumReader to include additional information about the union
5
- # index used.
5
+ # member index used. The code modified below is based on salsify/avro,
6
+ # branch 'salsify-master' with the tag 'v1.9.0.3'
6
7
  class DatumReader < Avro::IO::DatumReader
7
8
 
8
9
  UNION_MEMBER_INDEX = '__avromatic_member_index'.freeze
@@ -25,8 +26,7 @@ module Avromatic
25
26
  raise SchemaMatchException.new(writers_schema, readers_schema)
26
27
  end
27
28
 
28
- # function dispatch for reading data based on type of writer's
29
- # schema
29
+ # function dispatch for reading data based on type of writer's schema
30
30
  datum = case writers_schema.type_sym
31
31
  when :null; decoder.read_null
32
32
  when :boolean; decoder.read_boolean
@@ -46,6 +46,8 @@ module Avromatic
46
46
  raise AvroError.new("Cannot read unknown schema type: #{writers_schema.type}")
47
47
  end
48
48
 
49
+ # Allow this code to be used with an official Avro release or the
50
+ # avro-salsify-fork that includes logical_type support.
49
51
  if readers_schema.respond_to?(:logical_type)
50
52
  readers_schema.type_adapter.decode(datum)
51
53
  else
@@ -53,7 +55,7 @@ module Avromatic
53
55
  end
54
56
  end
55
57
 
56
- # Override to specify initial record that may contain union index
58
+ # Override to specify an initial record that may contain union index
57
59
  def read_record(writers_schema, readers_schema, decoder, initial_record = {})
58
60
  readers_fields_hash = readers_schema.fields_hash
59
61
  read_record = Avromatic.use_custom_datum_reader ? initial_record : {}
@@ -2,7 +2,7 @@ require 'avro_turf/messaging'
2
2
  require 'avromatic/io/datum_reader'
3
3
 
4
4
  module Avromatic
5
- # Subclass AvroTurf::Messaging to use a custom DatumReader
5
+ # Subclass AvroTurf::Messaging to use a custom DatumReader for decode.
6
6
  class Messaging < AvroTurf::Messaging
7
7
  def decode(data, schema_name: nil, namespace: @namespace)
8
8
  readers_schema = schema_name && @schema_store.find(schema_name, namespace)
@@ -24,7 +24,7 @@ module Avromatic
24
24
  @schemas_by_id[schema_id] = Avro::Schema.parse(schema_json)
25
25
  end
26
26
 
27
- # The following line was changed to use a custom DatumReader
27
+ # The following line differs from the parent class to use a custom DatumReader
28
28
  reader = Avromatic::IO::DatumReader.new(writers_schema, readers_schema)
29
29
  reader.read(decoder)
30
30
  end
@@ -1,3 +1,3 @@
1
1
  module Avromatic
2
- VERSION = '0.14.0.rc1'.freeze
2
+ VERSION = '0.14.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avromatic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0.rc1
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Salsify Engineering
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-17 00:00:00.000000000 Z
11
+ date: 2017-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avro
@@ -289,9 +289,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
289
289
  version: '0'
290
290
  required_rubygems_version: !ruby/object:Gem::Requirement
291
291
  requirements:
292
- - - ">"
292
+ - - ">="
293
293
  - !ruby/object:Gem::Version
294
- version: 1.3.1
294
+ version: '0'
295
295
  requirements: []
296
296
  rubyforge_project:
297
297
  rubygems_version: 2.6.8