README.md in avro-builder-0.7.0 vs README.md in avro-builder-0.8.0

- old
+ new

@@ -10,16 +10,21 @@ * The [Avro IDL](https://avro.apache.org/docs/current/idl.html) is not supported in Ruby. * The Avro IDL can only be used to define Protocols. * Schemas can be extracted as JSON from an IDL Protocol but support for imports is still limited. +Additional background on why we developed `avro-builder` is provided +[here](http://blog.salsify.com/engineering/adventures-in-avro). + ## Features * The syntax is designed for ease-of-use. * Definitions can be imported by name. This includes auto-loading from a configured set of paths. This allows definitions to split across files and even reused between projects. * Record definitions can inherit from other record definitions. +* [Schema Store](#schema-store) to load files written in the DSL and return + `Avro::Schema` objects. ## Limitations * Only Avro Schemas, not Protocols are supported. * See [Issues](https://github.com/salsify/avro-builder/issues) for functionality @@ -43,11 +48,11 @@ $ gem install avro-builder ## Usage -To use `Avro::Builder` define a schema: +To use `Avro::Builder`, define a schema: ```ruby namespace 'com.example' fixed :password, 8 @@ -243,9 +248,34 @@ A previously defined record may be referenced in the definition of another record using `extends <record_name>`. This adds all of the fields from the referenced record to the current record. The current record may override fields in the record that it extends. + +## Schema Store + +The `Avro::Builder::SchemaStore` can be used to load DSL files and return cached +`Avro::Schema` objects. This schema store can be used as the schema store for +[avromatic](https://github.com/salsify/avromatic) +to generate models directly from schemas defined using the DSL. + +The schema store must be initialized with the path where DSL files are located: + +```ruby +schema_store = Avro::Builder::SchemaStore.new(path: '/path/to/dsl/files') +schema_store.find('schema_name', 'my_namespace') +#=> Avro::Schema (for file at '/path/to/dsl/files/my_namespace/schema_name.rb') +``` + +To configure `Avromatic` to use this schema store and its Messaging API: + +```ruby +Avromatic.configure do |config| + config.schema_store = Avro::Builder::SchemaStore.new(path: 'avro/dsl') + config.registry_url = 'https://builder:avro@avro-schema-registry.salsify.com' + config.build_messaging! +end +``` ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.