avromatic 0.17.0 → 0.17.1
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 +3 -0
- data/README.md +26 -2
- data/lib/avromatic/io/datum_reader.rb +3 -3
- data/lib/avromatic/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5550bf0cf07c7178fee41695fa332666e06cb471
|
4
|
+
data.tar.gz: f687dd44e2950b2fd0f05417e0cead775eb77f85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3cc9796157abbde88c9c1c54ee6b158da087ea64b41a8da156b00bf6fc697247358046bdf53f9b8665aa7b751f171fed3d07bf92b38a4a5e77b9fb5001445c7
|
7
|
+
data.tar.gz: 65d6c900a70efed3309935966e0618f986850ea94c42b381e3fb8410410d0edf8369c308eb99a8d8e0219b46b3e0cd742a7fc55a15a156123e569ab0f4312267
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -24,6 +24,9 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
$ gem install avromatic
|
26
26
|
|
27
|
+
See the [Logical Types](#logical-types) section below for details on using
|
28
|
+
Avromatic with unreleased Avro features.
|
29
|
+
|
27
30
|
## Usage
|
28
31
|
|
29
32
|
### Configuration
|
@@ -47,6 +50,10 @@ Or install it yourself as:
|
|
47
50
|
option is useful for defining models that will be extended when the load order
|
48
51
|
is important.
|
49
52
|
|
53
|
+
#### Custom Types
|
54
|
+
|
55
|
+
See the section below on configuring [Custom Types](#custom-type-configuration).
|
56
|
+
|
50
57
|
#### Using a Schema Registry/Messaging API
|
51
58
|
|
52
59
|
The configuration options below are required when using a schema registry
|
@@ -69,7 +76,6 @@ and the [Messaging API](#messaging-api).
|
|
69
76
|
The `build_messaging!` method may be used to create a `Avromatic::Messaging`
|
70
77
|
instance based on the other configuration values.
|
71
78
|
* **logger**: The logger to use for the schema registry client.
|
72
|
-
* [Custom Types](#custom-types)
|
73
79
|
|
74
80
|
Example using a schema registry:
|
75
81
|
|
@@ -203,8 +209,9 @@ Avromatic.configure do |config|
|
|
203
209
|
MyNestedModel
|
204
210
|
]
|
205
211
|
end
|
212
|
+
```
|
206
213
|
|
207
|
-
#### Custom
|
214
|
+
#### Custom Type Configuration
|
208
215
|
|
209
216
|
Custom types can be configured for fields of named types (record, enum, fixed).
|
210
217
|
These customizations are registered on the `Avromatic` module. Once a custom type
|
@@ -352,6 +359,23 @@ The following validations are supported:
|
|
352
359
|
- Validity of nested records, including records embedded in array, maps, and
|
353
360
|
unions.
|
354
361
|
|
362
|
+
### Logical Types
|
363
|
+
|
364
|
+
Currently the official Apache Avro Ruby library does not support logical types ([AVRO-1695](https://issues.apache.org/jira/browse/AVRO-1695)).
|
365
|
+
That feature is in progress and will hopefully be merged soon.
|
366
|
+
|
367
|
+
Avromatic supports logical types as implemented in the [pull request](https://github.com/apache/avro/pull/116) referenced in AVRO-1695.
|
368
|
+
|
369
|
+
Until that change is included in the official library, you can
|
370
|
+
use [avro-salsify-fork gem](https://github.com/salsify/avro) which includes
|
371
|
+
the changes from the above pull request.
|
372
|
+
|
373
|
+
To use this gem, reference it in your Gemfile:
|
374
|
+
|
375
|
+
```ruby
|
376
|
+
gem 'avro-salsify-fork', require: 'avro'
|
377
|
+
````
|
378
|
+
|
355
379
|
### Unsupported/Future
|
356
380
|
|
357
381
|
The following types/features are not supported for generated models:
|
@@ -11,7 +11,7 @@ module Avromatic
|
|
11
11
|
def read_data(writers_schema, readers_schema, decoder, initial_record = {})
|
12
12
|
# schema matching
|
13
13
|
unless self.class.match_schemas(writers_schema, readers_schema)
|
14
|
-
raise SchemaMatchException.new(writers_schema, readers_schema)
|
14
|
+
raise Avro::IO::SchemaMatchException.new(writers_schema, readers_schema)
|
15
15
|
end
|
16
16
|
|
17
17
|
# schema resolution: reader's schema is a union, writer's schema is not
|
@@ -23,7 +23,7 @@ module Avromatic
|
|
23
23
|
union_info = { UNION_MEMBER_INDEX => rs_index }
|
24
24
|
|
25
25
|
return read_data(writers_schema, readers_schema.schemas[rs_index], decoder, union_info) if rs_index
|
26
|
-
raise SchemaMatchException.new(writers_schema, readers_schema)
|
26
|
+
raise Avro::IO::SchemaMatchException.new(writers_schema, readers_schema)
|
27
27
|
end
|
28
28
|
|
29
29
|
# function dispatch for reading data based on type of writer's schema
|
@@ -43,7 +43,7 @@ module Avromatic
|
|
43
43
|
when :union; read_union(writers_schema, readers_schema, decoder)
|
44
44
|
when :record, :error, :request; read_record(writers_schema, readers_schema, decoder, initial_record)
|
45
45
|
else
|
46
|
-
raise AvroError.new("Cannot read unknown schema type: #{writers_schema.type}")
|
46
|
+
raise Avro::AvroError.new("Cannot read unknown schema type: #{writers_schema.type}")
|
47
47
|
end
|
48
48
|
|
49
49
|
# Allow this code to be used with an official Avro release or the
|
data/lib/avromatic/version.rb
CHANGED
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.17.
|
4
|
+
version: 0.17.1
|
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-02-
|
11
|
+
date: 2017-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avro
|