avro-builder 0.3.0 → 0.3.1

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: 28daf07aca9de6893dcd2ca08f78448e2a6df151
4
- data.tar.gz: 0e3024fb6bf1caeaa24f65e79dc601802b663164
3
+ metadata.gz: 7ad527314da93e91b53852dc9ca99d58170db02b
4
+ data.tar.gz: 2c21f0fc2eb009ce181288ee367ff898016a2e5c
5
5
  SHA512:
6
- metadata.gz: a5b7073dd2493279f98724a1c8fc96fadaee310e80109978754e461f4475966f0fdade6137d08055de80f7e9a2a945123937a4fd15f76b683a948b9d91dbb413
7
- data.tar.gz: e577b679d984e96cb849b478306b08527f0c831fcdbede83292e760d53ac125d7c622304f80b5d2a190e867ca7a2d34f6bae3e3c27e67f97c713351eefb98dbe
6
+ metadata.gz: 84d0a142b89fdc3bb831350708a92d39ca96f78233bdae4e62873d1f897d23329a16da60efa3fca3b9643772698e03ff5a0d9eb0ff4f592f68508eac3b35c8bb
7
+ data.tar.gz: be8d9e8135b2cd68b90820545de07028f68500c7592d8e09b08a2acf9c333a73c22be42e0df2baccb54fb2fa6076732cbe7acad3d25d4274684491d874e879e5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # avro-builder changelog
2
2
 
3
+ ## v0.3.1
4
+ - A `null` default should automatically be added for optional fields to match
5
+ the `:null` first member of the union.
6
+
3
7
  ## v0.3.0
4
8
  - Add support for nested records. This includes the ability to reference a
5
9
  previously defined record as a type.
data/README.md CHANGED
@@ -108,7 +108,8 @@ This generates the following Avro JSON schema:
108
108
  "type": [
109
109
  "null",
110
110
  "string"
111
- ]
111
+ ],
112
+ "default": null
112
113
  }
113
114
  ]
114
115
  }
@@ -117,7 +118,8 @@ This generates the following Avro JSON schema:
117
118
  ### Required and Optional
118
119
 
119
120
  Fields for a record are specified as `required` or `optional`. Optional fields are
120
- implemented as a union in Avro, where `null` is the first type in the union.
121
+ implemented as a union in Avro, where `null` is the first type in the union and
122
+ the field has a default value of `null`.
121
123
 
122
124
  ### Named Types
123
125
 
@@ -206,7 +208,7 @@ end
206
208
  ```
207
209
 
208
210
  For an optional union, `null` is automatically added as the first type for
209
- the union.
211
+ the union and the field defaults to `null`.
210
212
 
211
213
  ### Auto-loading and Imports
212
214
 
@@ -68,7 +68,9 @@ module Avro
68
68
  doc: doc,
69
69
  default: default,
70
70
  aliases: aliases
71
- }.reject { |_, v| v.nil? }
71
+ }.reject { |_, v| v.nil? }.tap do |result|
72
+ result.merge!(default: nil) if optional_field
73
+ end
72
74
  end
73
75
 
74
76
  private
@@ -1,5 +1,5 @@
1
1
  module Avro
2
2
  module Builder
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.1"
4
4
  end
5
5
  end
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.3.0
4
+ version: 0.3.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: 2016-03-21 00:00:00.000000000 Z
11
+ date: 2016-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avro