项目作者: okitan

项目描述 :
generate fake data for json schema
高级语言: Ruby
项目地址: git://github.com/okitan/json_schema-faker.git
创建时间: 2016-05-15T06:35:40Z
项目社区:https://github.com/okitan/json_schema-faker

开源协议:MIT License

下载


JsonSchema::Faker Build Status

Installation

Add this line to your application’s Gemfile:

  1. gem 'json_schema-faker'

And then execute:

  1. $ bundle

Or install it yourself as:

  1. $ gem install json_schema-faker

Usage

  1. require "json_schema/faker"
  2. raw_schema = {
  3. "id" => "https://example.com/schema.json",
  4. "$schema" => "http://json-schema.org/draft-04/schema#",
  5. "properties" => { "a" => { "enum" => [ "e", "n", "u", "m" ] } },
  6. "required" => [ "a" ],
  7. }
  8. schema = JsonSchema.parse!(raw_schema)
  9. JsonSchema::Faker.new(schema).generate #=> { "a" => "e" }

Note: It is too difficult to correspond to complex schema.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/json_schema-faker. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

Run tests

before running rake spec, run git submodule init && git submodule update

License

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