avromatic 0.9.0 → 0.10.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 +4 -4
 - data/CHANGELOG.md +4 -0
 - data/README.md +12 -17
 - data/lib/avromatic.rb +6 -1
 - data/lib/avromatic/model_registry.rb +4 -0
 - data/lib/avromatic/railtie.rb +4 -0
 - data/lib/avromatic/version.rb +1 -1
 - metadata +4 -4
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 9363333d113fdde131539f8b2d49aa36570bac26
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 22abde6607fa1214c5a29f109d3cedbbe0573ba6
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 13f164b073113a5abf9287b4cc409a1588b6e328b2f079626bc83ffb768b9f8db6fd761f8bfb648f365bedc7b36a683e4d755e84558a9bb7a13236937a08bffc
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: edb4c66c1dbb1d1c22a0b24064b0ed0eae890c7d0a787f27e643a3010ed4f590c012c740e2c0b918919eaa071a14482933c4c1539ac36082c42d9ae1006adde5
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,5 +1,9 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # avromatic changelog
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            ## v0.10.0 (unreleased)
         
     | 
| 
      
 4 
     | 
    
         
            +
            - Add `Avromatic.on_initialize` proc that is called in Rails applications after
         
     | 
| 
      
 5 
     | 
    
         
            +
              the initializers run and on code reloading.
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
       3 
7 
     | 
    
         
             
            ## v0.9.0
         
     | 
| 
       4 
8 
     | 
    
         
             
            - Experimental: Add support for more than one non-null type in a union.
         
     | 
| 
       5 
9 
     | 
    
         
             
            - Allow nested models to be referenced and reused.
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -162,22 +162,16 @@ Avromatic::Model.model(schema_name, :my_model 
     | 
|
| 
       162 
162 
     | 
    
         
             
                                   nested_models: ModelRegistry.new)
         
     | 
| 
       163 
163 
     | 
    
         
             
            ```
         
     | 
| 
       164 
164 
     | 
    
         | 
| 
       165 
     | 
    
         
            -
             
     | 
| 
       166 
     | 
    
         
            -
             
     | 
| 
      
 165 
     | 
    
         
            +
            Only models without a key schema can be used as nested models. When a model is
         
     | 
| 
      
 166 
     | 
    
         
            +
            generated with just a value schema then it is automatically registered so that
         
     | 
| 
      
 167 
     | 
    
         
            +
            it can be used as a nested model.
         
     | 
| 
       167 
168 
     | 
    
         | 
| 
       168 
     | 
    
         
            -
             
     | 
| 
       169 
     | 
    
         
            -
             
     | 
| 
       170 
     | 
    
         
            -
              include Avromatic::Model.build(schema_name: 'useful_subrecord')
         
     | 
| 
       171 
     | 
    
         
            -
             
     | 
| 
       172 
     | 
    
         
            -
              def do_something_custom
         
     | 
| 
       173 
     | 
    
         
            -
                ...
         
     | 
| 
       174 
     | 
    
         
            -
              end
         
     | 
| 
       175 
     | 
    
         
            -
            end
         
     | 
| 
       176 
     | 
    
         
            -
            Avromatic.nested_models.register(UsefulSubrecord)
         
     | 
| 
       177 
     | 
    
         
            -
            ```
         
     | 
| 
      
 169 
     | 
    
         
            +
            To extend a model that will be used as a nested model, you must ensure that it
         
     | 
| 
      
 170 
     | 
    
         
            +
            is defined, which will register it, prior it being referenced by another model.
         
     | 
| 
       178 
171 
     | 
    
         | 
| 
       179 
     | 
    
         
            -
            With Rails, it may be necessary to  
     | 
| 
       180 
     | 
    
         
            -
             
     | 
| 
      
 172 
     | 
    
         
            +
            With Rails for example, it may be necessary to reference in an initializer
         
     | 
| 
      
 173 
     | 
    
         
            +
            models that are extended and will be used as nested models so that classes load
         
     | 
| 
      
 174 
     | 
    
         
            +
            in the correct order.
         
     | 
| 
       181 
175 
     | 
    
         | 
| 
       182 
176 
     | 
    
         
             
            #### Custom Types
         
     | 
| 
       183 
177 
     | 
    
         | 
| 
         @@ -315,15 +309,16 @@ The following validations are supported: 
     | 
|
| 
       315 
309 
     | 
    
         | 
| 
       316 
310 
     | 
    
         
             
            - The size of the value for a fixed type field.
         
     | 
| 
       317 
311 
     | 
    
         
             
            - The value for an enum type field is in the declared set of values.
         
     | 
| 
       318 
     | 
    
         
            -
            - Presence of a value for required fields.
         
     | 
| 
      
 312 
     | 
    
         
            +
            - Presence of a value for required fields. Empty arrays and maps are considered
         
     | 
| 
      
 313 
     | 
    
         
            +
              valid for required fields.
         
     | 
| 
      
 314 
     | 
    
         
            +
            - Validity of nested records, including records embedded in array, maps, and
         
     | 
| 
      
 315 
     | 
    
         
            +
              unions.
         
     | 
| 
       319 
316 
     | 
    
         | 
| 
       320 
317 
     | 
    
         
             
            ### Unsupported/Future
         
     | 
| 
       321 
318 
     | 
    
         | 
| 
       322 
319 
     | 
    
         
             
            The following types/features are not supported for generated models:
         
     | 
| 
       323 
320 
     | 
    
         | 
| 
       324 
321 
     | 
    
         
             
            - Custom types for members within a union.
         
     | 
| 
       325 
     | 
    
         
            -
            - Reused models for nested records: Currently an anonymous model class is
         
     | 
| 
       326 
     | 
    
         
            -
              generated for each subrecord.
         
     | 
| 
       327 
322 
     | 
    
         | 
| 
       328 
323 
     | 
    
         
             
            ## Development
         
     | 
| 
       329 
324 
     | 
    
         | 
    
        data/lib/avromatic.rb
    CHANGED
    
    | 
         @@ -7,7 +7,7 @@ require 'avro_turf/messaging' 
     | 
|
| 
       7 
7 
     | 
    
         
             
            module Avromatic
         
     | 
| 
       8 
8 
     | 
    
         
             
              class << self
         
     | 
| 
       9 
9 
     | 
    
         
             
                attr_accessor :schema_registry, :registry_url, :schema_store, :logger,
         
     | 
| 
       10 
     | 
    
         
            -
                              :messaging, :type_registry, :nested_models
         
     | 
| 
      
 10 
     | 
    
         
            +
                              :messaging, :type_registry, :nested_models, :on_initialize
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
                delegate :register_type, to: :type_registry
         
     | 
| 
       13 
13 
     | 
    
         
             
              end
         
     | 
| 
         @@ -39,6 +39,11 @@ module Avromatic 
     | 
|
| 
       39 
39 
     | 
    
         
             
              def self.build_messaging!
         
     | 
| 
       40 
40 
     | 
    
         
             
                self.messaging = build_messaging
         
     | 
| 
       41 
41 
     | 
    
         
             
              end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
              def self.prepare!
         
     | 
| 
      
 44 
     | 
    
         
            +
                nested_models.clear
         
     | 
| 
      
 45 
     | 
    
         
            +
                on_initialize.call if on_initialize
         
     | 
| 
      
 46 
     | 
    
         
            +
              end
         
     | 
| 
       42 
47 
     | 
    
         
             
            end
         
     | 
| 
       43 
48 
     | 
    
         | 
| 
       44 
49 
     | 
    
         
             
            require 'avromatic/railtie' if defined?(Rails)
         
     | 
    
        data/lib/avromatic/railtie.rb
    CHANGED
    
    
    
        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. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.10.0.rc0
         
     | 
| 
       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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-10-03 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: avro
         
     | 
| 
         @@ -287,9 +287,9 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       287 
287 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       288 
288 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       289 
289 
     | 
    
         
             
              requirements:
         
     | 
| 
       290 
     | 
    
         
            -
              - - " 
     | 
| 
      
 290 
     | 
    
         
            +
              - - ">"
         
     | 
| 
       291 
291 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       292 
     | 
    
         
            -
                  version:  
     | 
| 
      
 292 
     | 
    
         
            +
                  version: 1.3.1
         
     | 
| 
       293 
293 
     | 
    
         
             
            requirements: []
         
     | 
| 
       294 
294 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       295 
295 
     | 
    
         
             
            rubygems_version: 2.4.8
         
     |