{"id":28547125,"url":"https://github.com/mirego/active_model_serializers_validator","last_synced_at":"2025-07-29T06:04:16.159Z","repository":{"id":8627909,"uuid":"10272901","full_name":"mirego/active_model_serializers_validator","owner":"mirego","description":":black_joker: An extension to ActiveModel::Serializer that validates serializers output against a JSON schema","archived":false,"fork":false,"pushed_at":"2017-02-22T21:27:29.000Z","size":332,"stargazers_count":18,"open_issues_count":0,"forks_count":1,"subscribers_count":62,"default_branch":"master","last_synced_at":"2025-07-12T03:12:09.360Z","etag":null,"topics":["activemodel","activerecord","json-schema"],"latest_commit_sha":null,"homepage":"http://open.mirego.com","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mirego.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-05-24T18:53:37.000Z","updated_at":"2019-12-19T16:52:54.000Z","dependencies_parsed_at":"2022-08-29T07:42:07.516Z","dependency_job_id":null,"html_url":"https://github.com/mirego/active_model_serializers_validator","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/mirego/active_model_serializers_validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirego%2Factive_model_serializers_validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirego%2Factive_model_serializers_validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirego%2Factive_model_serializers_validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirego%2Factive_model_serializers_validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mirego","download_url":"https://codeload.github.com/mirego/active_model_serializers_validator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirego%2Factive_model_serializers_validator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265854687,"owners_count":23839436,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["activemodel","activerecord","json-schema"],"created_at":"2025-06-10T00:09:32.753Z","updated_at":"2025-07-29T06:04:16.135Z","avatar_url":"https://github.com/mirego.png","language":"Ruby","readme":"# ActiveModel::Serializer::Validator\n\n[![Gem Version](http://img.shields.io/gem/v/active_model_serializers_validator.svg)](https://rubygems.org/gems/active_model_serializers_validator)\n[![Code Climate](http://img.shields.io/codeclimate/github/mirego/active_model_serializers_validator.svg)](https://codeclimate.com/github/mirego/active_model_serializers_validator)\n[![Build Status](http://img.shields.io/travis/mirego/active_model_serializers_validator.svg)](https://travis-ci.org/mirego/active_model_serializers_validator)\n\nThis gem adds JSON schema validations for the JSON output generated by an `ActiveModel::Serializer`.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'active_model_serializers_validator'\n```\n\n## Usage\n\nThe gem adds two instance methods (`#valid?` and `#errors`) and one class method (`.json_schema`) to the `ActiveModel::Serializer` class.\n\n### A JSON schema\n\n```json\n{\n  \"type\": \"object\",\n  \"$schema\": \"http://json-schema.org/draft-03/schema\",\n  \"id\": \"#\",\n  \"required\": false,\n  \"additionalProperties\": false,\n  \"properties\": {\n    \"favorite_number\": {\n      \"type\": \"integer\",\n      \"id\": \"favorite_number\",\n      \"required\": true\n    },\n  }\n}\n```\n\n### A serializer\n\n```ruby\nclass MySerializer \u003c ActiveModel::Serializer\n  json_schema '/path/to/my/schema.jsonschema'\n  attribute :favorite_number\nend\n\nobject = OpenStruct.new(favorite_number: 'what?')\nserializer = MySerializer.new(object)\n\nserializer.valid?\n# =\u003e false\n\nserializer.errors\n# =\u003e [The property '#/foo' of type String did not match the following type: integer in schema /path/to/my/schema.jsonschema]\n```\n\n## License\n\n`ActiveModel::Serializer::Validator` is © 2013-2015 [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/active_model_serializers_validator/blob/master/LICENSE.md) file.\n\n## About Mirego\n\n[Mirego](http://mirego.com) is a team of passionate people who believe that work is a place where you can innovate and have fun. We're a team of [talented people](http://life.mirego.com) who imagine and build beautiful Web and mobile applications. We come together to share ideas and [change the world](http://mirego.org).\n\nWe also [love open-source software](http://open.mirego.com) and we try to give back to the community as much as we can.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirego%2Factive_model_serializers_validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmirego%2Factive_model_serializers_validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirego%2Factive_model_serializers_validator/lists"}