Sha256: 09d6f57243a63dbcf5163c57cda3fff3ff9aff57fd5966ddd8c723e8fa14212d

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

# ActiveModel::Serializer::Validator

This gem adds JSON schema validations for output generated by an `ActiveModel::Serializer`.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'active_model_serializers_validator'
```

## Usage

The gem adds one instance method and one class method to the `ActiveModel::Serializer` class, `#valid?` and `.json_schema`:

```ruby
class MySerializer < ActiveModel::Serializer
  json_schema '/path/to/my/schema.jsonschema'

  attribute :foo
  attribute :bar
end

serializer = MySerializer.new(OpenStruct.new(foo: 'bla'))
serializer.valid?
# => false
```

## Todo

* Provide more details as to why the validation failed.
* Add more features! :smile:

## License

`ActiveModel::Serializer::Validator` is © 2013 [Mirego](http://www.mirego.com) and may be freely distributed under the [New BSD license](http://opensource.org/licenses/BSD-3-Clause).  See the [`LICENSE.md`](https://github.com/mirego/MCUIImageAdvanced/blob/master/LICENSE.md) file.

## About Mirego

Mirego is a team of passionate people who believe that work is a place where you can innovate and have fun. We proudly built mobile applications for iPhone, iPad, Android, Blackberry, Windows Phone and Windows 8.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_model_serializers_validator-0.1.1 README.md
active_model_serializers_validator-0.1 README.md