avro-builder 0.16.2 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +3 -0
- data/lib/avro/builder/types/enum_type.rb +9 -2
- data/lib/avro/builder/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a91ca8206639d20fe48b9ef6f634493a08af34afe223ad06d12c3e930f45bc91
|
4
|
+
data.tar.gz: 12ed60307f215d22416ffc2f2d33966ff4481e4cfadb4c011275e811dc6fcfa4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2db9b4753353a9a1e8ecc4c90c5127d21fc4f13f985ce1ab6c5e387cc153691f5a27deb7f2784d92413dace0052c214c0f640779a296f6cfdcceb266c6ec9152
|
7
|
+
data.tar.gz: 96565b0a5bccb29930970c992e6f09dabb2c9af640a912ffaffe0c0e53f65820a1378fb7a4799585f9e45337d71c293476b87742c2ebd7060320f5bde8300ab3
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -165,6 +165,9 @@ fixed :g, size: 8
|
|
165
165
|
enum :e, :X, :Y, :Z
|
166
166
|
enum :d, symbols: [:A, :B]
|
167
167
|
|
168
|
+
# defaults can be set for enums with Ruby Avro v1.10.0
|
169
|
+
enum :c, symbols: [:A, :B], default: :A
|
170
|
+
|
168
171
|
record :my_record_with_named do
|
169
172
|
required :f_ref, :f
|
170
173
|
required :fixed_inline, :fixed, size: 9
|
@@ -5,7 +5,7 @@ module Avro
|
|
5
5
|
module Types
|
6
6
|
class EnumType < NamedType
|
7
7
|
|
8
|
-
|
8
|
+
dsl_attributes :doc, :default
|
9
9
|
|
10
10
|
dsl_attribute :symbols do |*values|
|
11
11
|
# Define symbols explicitly to support values as a splat or single array
|
@@ -27,12 +27,19 @@ module Avro
|
|
27
27
|
def validate!
|
28
28
|
super
|
29
29
|
validate_required_attribute!(:symbols)
|
30
|
+
validate_enum_default!
|
30
31
|
end
|
31
32
|
|
32
33
|
private
|
33
34
|
|
35
|
+
def validate_enum_default!
|
36
|
+
if !default.nil? && !symbols.map(&:to_sym).include?(default.to_sym)
|
37
|
+
raise AttributeError.new("enum default '#{default}' must be one of the enum symbols: #{symbols}")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
34
41
|
def serialized_attributes
|
35
|
-
{ symbols: symbols, doc: doc }
|
42
|
+
{ symbols: symbols, doc: doc, default: default }
|
36
43
|
end
|
37
44
|
end
|
38
45
|
end
|
data/lib/avro/builder/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avro-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.17.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: 2020-
|
11
|
+
date: 2020-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avro
|