Sha256: 81f4a79ba77a200de3a385d60619197cc0d1e4f701ae4e3ab9d01b9dc1ada4b5

Contents?: true

Size: 819 Bytes

Versions: 4

Compression:

Stored size: 819 Bytes

Contents

require File.expand_path('../test_helper', __FILE__)

class FragmentValidationWithRef < Minitest::Test
  def whole_schema
    {
      "$schema" => "http://json-schema.org/draft-04/schema#",
      "type" => "object",
      "definitions" => {
        "post" => {
          "type" => "object",
          "properties" => {
            "content" => {
              "type" => "string"
            },
            "author" => {
              "type" => "string"
            }
          }
        },
        "posts" => {
          "type" => "array",
          "items" => {
            "$ref" => "#/definitions/post"
          }
        }
      }
    }
  end

  def test_validation_of_fragment
    data = [{"content" => "ohai", "author" => "Bob"}]
    assert_valid whole_schema, data, :fragment => "#/definitions/posts"
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
json-schema-openc-fork-0.0.2 test/test_fragment_validation_with_ref.rb
json-schema-2.5.1 test/test_fragment_validation_with_ref.rb
json-schema-openc-fork-0.0.1 test/test_fragment_validation_with_ref.rb
json-schema-2.5.0 test/test_fragment_validation_with_ref.rb