Gem Version Build Status

An automatic JSON response validator for testing in Rails

SchemaConformist is an automatic JSON response validator for your API testing in Rails.

This library automatically validates that JSON responses are conformant with the schema. The schema can be described as either JSON Hyper Schema or OpenAPI 2.0.

This library uses Committee and Committee::Rails to validate JSONs and is assumed that used with API mode Rails.



Add this line to your application's Gemfile:

gem 'schema_conformist'

and execute bundle install.

That's all. Then all JSON responses in integration-test/request-spec are validated according to your schema.

Writing the Schema

Write your API schema in either JSON Hyper Schema or OpenAPI 2. For now, the default driver is set to JSON Hyper Schema and default schema paths are following:

  • JSON Hyper Schema: public/schema.json
  • OpenAPI 2: public/swagger.json

See test/dummy app for examples.


Configuration options are following:

  • schema_conformist.driver
    • :hyper_schema: Use JSON Hyper Schema as schema format
    • :open_api_2: Use OpenAPI 2 as schema format (both JSON and YAML are available as schema files)
  • schema_conformist.ignored_api_paths
    • The array of API paths not to validate. Each path can be described in regular expression.
  • schema_conformist.schema_path
    • The path where the schema is placed


Rails.application.config.schema_conformist.driver = :open_api_2
Rails.application.config.schema_conformist.ignored_api_paths << /private/
Rails.application.config.schema_conformist.schema_path = Rails.root.join('doc', 'swagger.yaml')


Bug reports and pull requests are welcome on GitHub at


The gem is available as open source under the terms of the MIT License.