From 0fbbb4e4a3e5036f9ae9d94f41f36009d4868296 Mon Sep 17 00:00:00 2001 From: Iain Beeston Date: Fri, 30 Jun 2017 13:50:21 +0100 Subject: [PATCH 01/22] Made sure we require timeout before using it If you run `JSON::Validator.validate(metaschema, "http://a/%%30%30")` then you'll see the error "uninitialized constant Timeout". This is happening because we reference `Timeout` in `Validator` without requiring it. Interestingly I can't reproduce this error in the test suite because something else (probably webmock?) is already requiring timeout for us, and this error does not occur. Fixes #384 --- CHANGELOG.md | 1 + lib/json-schema/validator.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1be4860a..d5895a13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Rescue URI error when initializing a data string that contains a colon - Fragments with an odd number of components no longer raise an `undefined method `validate'` error +- Loading data from a url no longer raises a "uninitialized constant JSON::Validator::Timeout" error ## [2.8.0] - 2017-02-07 diff --git a/lib/json-schema/validator.rb b/lib/json-schema/validator.rb index c439b613..2dc4c688 100644 --- a/lib/json-schema/validator.rb +++ b/lib/json-schema/validator.rb @@ -4,6 +4,7 @@ require 'digest/sha1' require 'date' require 'thread' +require 'timeout' require 'yaml' require 'json-schema/schema/reader' From 1a2a9a30150b9e6b77948d58196902638b355e83 Mon Sep 17 00:00:00 2001 From: Iain Beeston Date: Sun, 14 Oct 2018 07:17:20 +0100 Subject: [PATCH 02/22] Bumped version to 2.8.1 Fixes #415 --- CHANGELOG.md | 2 ++ VERSION.yml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1be4860a..e5097bf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## [2.8.1] - 2019-10-14 + ### Changed - All limit classes are now stored in their own files in 'json-schema/attributes/limits' - All attribute classes are now stored in their own files in 'json-schema/attributes' diff --git a/VERSION.yml b/VERSION.yml index f9e96e5e..dcd73b51 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,3 +1,3 @@ major: 2 minor: 8 -patch: 0 +patch: 1 From 771b820237086129580916b86534edfda8f6d918 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Mon, 15 Oct 2018 01:54:22 +0700 Subject: [PATCH 03/22] Fix typo in Changelog (2019 => 2018) --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e5097bf9..7a9a46b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] -## [2.8.1] - 2019-10-14 +## [2.8.1] - 2018-10-14 ### Changed - All limit classes are now stored in their own files in 'json-schema/attributes/limits' From 05ca777389f74ff520cfc267851d85415b8f8d4d Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Mon, 15 Oct 2018 02:25:36 +0700 Subject: [PATCH 04/22] Load VERSION.yml from relative path, so that developers can use "bundle config local.json-schema" to reference the local project --- json-schema.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json-schema.gemspec b/json-schema.gemspec index 2ac39f3c..2463b882 100644 --- a/json-schema.gemspec +++ b/json-schema.gemspec @@ -1,6 +1,6 @@ require 'yaml' -version_yaml = YAML.load(File.open('VERSION.yml').read) +version_yaml = YAML.load(File.open(File.expand_path('../VERSION.yml', __FILE__)).read) version = "#{version_yaml['major']}.#{version_yaml['minor']}.#{version_yaml['patch']}" gem_name = "json-schema" From 96941cb4b7eae6fb9d6241a10353e3a4b32e5b01 Mon Sep 17 00:00:00 2001 From: Carlos Adrian Gomez Date: Tue, 11 Aug 2020 15:17:38 -0700 Subject: [PATCH 05/22] Update README.md s/condisidered/considered --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bd29da49..29c4ad6f 100644 --- a/README.md +++ b/README.md @@ -166,7 +166,7 @@ JSON::Validator.validate(schema, [{"a" => 1}, {"a" => 2}, {"a" => 3}]) JSON::Validator.fully_validate(schema, { "a" => "taco" }, :errors_as_objects => true) # -# with the `:strict` option, all properties are condisidered to have `"required": true` and all objects `"additionalProperties": false` +# with the `:strict` option, all properties are considered to have `"required": true` and all objects `"additionalProperties": false` # # => true From 5990ed775565ad4f662fbecedfefbbe1e7d641af Mon Sep 17 00:00:00 2001 From: Ahsan Nabi Dar Date: Mon, 30 Aug 2021 13:21:36 +0500 Subject: [PATCH 06/22] Update json-schema.gemspec `Regular Expression Denial of Service in Addressable templates` https://github.com/advisories/GHSA-jxhc-q857-3j6g --- json-schema.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json-schema.gemspec b/json-schema.gemspec index 2463b882..60c6d267 100644 --- a/json-schema.gemspec +++ b/json-schema.gemspec @@ -23,5 +23,5 @@ Gem::Specification.new do |s| s.add_development_dependency "webmock" s.add_development_dependency "bundler" - s.add_runtime_dependency "addressable", '>= 2.4' + s.add_runtime_dependency "addressable", '>= 2.8' end From c0a2294fb101bf07743393e2605882f3aebcecda Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 2 Sep 2021 14:49:21 +0200 Subject: [PATCH 07/22] update README.md --- README.md | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 29c4ad6f..5b2750a1 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ -[![Gem Version](https://badge.fury.io/rb/json-schema.svg)](https://badge.fury.io/rb/json-schema) -[![Travis](https://travis-ci.org/ruby-json-schema/json-schema.svg?branch=master)](https://travis-ci.org/ruby-json-schema/json-schema) -[![Code Climate](https://codeclimate.com/github/ruby-json-schema/json-schema/badges/gpa.svg)](https://codeclimate.com/github/ruby-json-schema/json-schema) +# Ruby JSON Schema Validator -Ruby JSON Schema Validator -========================== +[![License](https://img.shields.io/github/license/voxpupuli/json-schema.svg)](https://github.com/voxpupuli/json-schema/blob/master/LICENSE) +[![Test](https://github.com/voxpupuli/json-schema/actions/workflows/test.yml/badge.svg)](https://github.com/voxpupuli/json-schema/actions/workflows/test.yml) +[![Release](https://github.com/voxpupuli/json-schema/actions/workflows/release.yml/badge.svg)](https://github.com/voxpupuli/json-schema/actions/workflows/release.yml) +[![RubyGem Version](https://img.shields.io/gem/v/json-schema.svg)](https://rubygems.org/gems/json-schema) +[![RubyGem Downloads](https://img.shields.io/gem/dt/json-schema.svg)](https://rubygems.org/gems/json-schema) +[![Donated by Iain Beeston](https://img.shields.io/badge/donated%20by-Iain%20Beeston-fb7047.svg)](#transfer-notice) This library is intended to provide Ruby with an interface for validating JSON objects against a JSON schema conforming to [JSON Schema Draft @@ -472,3 +474,23 @@ value is of the correct datatype (e.g., an instance value is validated to be an integer or a float in the case of 'utc-millisec'). Additionally, JSON::Validator does not handle any json hyperschema attributes. + +# Transfer Notice + +This plugin was originally authored by [Iain Beeston](https://github.com/iainbeeston). +The maintainer preferred that [Vox Pupuli](https://voxpupuli.org/) take ownership of the module for future improvement and maintenance. +Existing pull requests and issues were transferred, please fork and continue to contribute [here](https://github.com/voxpupuli/json-schema). + +# License + +This gem is licensed unter the [MIT license](LICENSE.md). + +## Release information + +To make a new release, please do: +* update the version in VERSION.yml +* Install gems with `bundle install --with release --path .vendor` +* generate the changelog with `bundle exec rake changelog` +* Check if the new version matches the closed issues/PRs in the changelog +* Create a PR with it +* After it got merged, push a tag. GitHub actions will do the actual release to rubygems and GitHub Packages From 09334099bff12bbfeb865875cccaae345d7d1a3f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 2 Sep 2021 14:49:30 +0200 Subject: [PATCH 08/22] Update gemspec --- json-schema.gemspec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/json-schema.gemspec b/json-schema.gemspec index 60c6d267..60979a14 100644 --- a/json-schema.gemspec +++ b/json-schema.gemspec @@ -7,9 +7,9 @@ gem_name = "json-schema" Gem::Specification.new do |s| s.name = gem_name s.version = version - s.authors = ["Kenny Hoxworth"] - s.email = "hoxworth@gmail.com" - s.homepage = "http://github.com/ruby-json-schema/json-schema/tree/master" + s.authors = ["Kenny Hoxworth", "Vox Pupuli"] + s.email = "voxpupuli@groups.io" + s.homepage = "http://github.com/voxpupuli/json-schema/" s.summary = "Ruby JSON Schema Validator" s.files = Dir[ "lib/**/*", "resources/*.json" ] s.require_path = "lib" From cdab313fb444f0600b844ac534902fecc088c471 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 2 Sep 2021 14:52:07 +0200 Subject: [PATCH 09/22] migrate to GitHub actions --- .github/workflows/release.yml | 32 ++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 32 ++++++++++++++++++++++++++++++++ .travis.yml | 30 ------------------------------ Gemfile | 19 ++++++++++++++++--- gemfiles/Gemfile.multi_json.x | 5 ----- gemfiles/Gemfile.ruby_19.x | 7 ------- gemfiles/Gemfile.uuidtools.x | 5 ----- gemfiles/Gemfile.yajl-ruby.x | 5 ----- test/support/test_helper.rb | 23 +++++++++++++++++++++-- 9 files changed, 101 insertions(+), 57 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml delete mode 100644 gemfiles/Gemfile.multi_json.x delete mode 100644 gemfiles/Gemfile.ruby_19.x delete mode 100644 gemfiles/Gemfile.uuidtools.x delete mode 100644 gemfiles/Gemfile.yajl-ruby.x diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..a44a9dac --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,32 @@ +name: Release + +on: + push: + tags: + - '*' + +jobs: + release: + runs-on: ubuntu-latest + if: github.repository_owner == 'voxpupuli' + steps: + - uses: actions/checkout@v2 + - name: Install Ruby 3.0 + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + env: + BUNDLE_WITHOUT: release + - name: Build gem + run: gem build *.gemspec + - name: Publish gem to rubygems.org + run: gem push *.gem + env: + GEM_HOST_API_KEY: '${{ secrets.RUBYGEMS_AUTH_TOKEN }}' + - name: Setup GitHub packages access + run: | + mkdir -p ~/.gem + echo ":github: Bearer ${{ secrets.GITHUB_TOKEN }}" >> ~/.gem/credentials + chmod 0600 ~/.gem/credentials + - name: Publish gem to GitHub packages + run: gem push --key github --host https://rubygems.pkg.github.com/voxpupuli *.gem diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..0937024e --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,32 @@ +name: Test + +on: + - pull_request + - push + +env: + BUNDLE_WITHOUT: release + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - ruby: "2.4" + - ruby: "2.5" + coverage: "yes" + env: + COVERAGE: ${{ matrix.coverage }} + steps: + - uses: actions/checkout@v2 + - name: Install Ruby ${{ matrix.ruby }} + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Run tests + run: bundle exec rake + - name: Build gem + run: gem build *.gemspec diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e12623d0..00000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: "ruby" - -rvm: - - "1.9" - - "2.0" - - "2.1" - - "2.2" - - "2.3" - - "2.4" - - "2.5" - - "jruby-1.7" - - "jruby-9.1" - -sudo: false - -install: - - bundle install --retry=3 - -matrix: - include: - - rvm: "1.9" - gemfile: "gemfiles/Gemfile.ruby_19.x" - - rvm: "jruby-1.7" - gemfile: "gemfiles/Gemfile.ruby_19.x" - - rvm: "2.5" - gemfile: "gemfiles/Gemfile.multi_json.x" - - rvm: "2.5" - gemfile: "gemfiles/Gemfile.yajl-ruby.x" - - rvm: "2.5" - gemfile: "gemfiles/Gemfile.uuidtools.x" diff --git a/Gemfile b/Gemfile index 5bf28e53..81222954 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,19 @@ -source "https://rubygems.org" +source 'https://rubygems.org' gemspec -gem "json", ">= 1.7", :platforms => :mri_19 -gem 'simplecov', :require => false +group :release do + gem 'github_changelog_generator', require: false +end + +group :coverage, optional: ENV['COVERAGE']!='yes' do + gem 'simplecov-console', :require => false + gem 'codecov', :require => false +end + +group :tests do + gem 'rubocop', '~> 1.11.0' + gem 'rubocop-rspec', '~> 2.2.0' + gem 'rubocop-rake', '~> 0.5.1' + gem 'rubocop-performance', '~> 1.10.2' +end diff --git a/gemfiles/Gemfile.multi_json.x b/gemfiles/Gemfile.multi_json.x deleted file mode 100644 index 349d18d8..00000000 --- a/gemfiles/Gemfile.multi_json.x +++ /dev/null @@ -1,5 +0,0 @@ -source "https://rubygems.org" - -gemspec :path => "../" - -gem "multi_json" diff --git a/gemfiles/Gemfile.ruby_19.x b/gemfiles/Gemfile.ruby_19.x deleted file mode 100644 index 6fb8eaf7..00000000 --- a/gemfiles/Gemfile.ruby_19.x +++ /dev/null @@ -1,7 +0,0 @@ -source "https://rubygems.org" - -gemspec :path => "../" - -gem "json", "~> 1.0" -gem "addressable", "< 2.5" -gem "webmock", "< 3" diff --git a/gemfiles/Gemfile.uuidtools.x b/gemfiles/Gemfile.uuidtools.x deleted file mode 100644 index e3f30e93..00000000 --- a/gemfiles/Gemfile.uuidtools.x +++ /dev/null @@ -1,5 +0,0 @@ -source "https://rubygems.org" - -gemspec :path => "../" - -gem "uuidtools" diff --git a/gemfiles/Gemfile.yajl-ruby.x b/gemfiles/Gemfile.yajl-ruby.x deleted file mode 100644 index c9f10cca..00000000 --- a/gemfiles/Gemfile.yajl-ruby.x +++ /dev/null @@ -1,5 +0,0 @@ -source "https://rubygems.org" - -gemspec :path => "../" - -gem "yajl-ruby" diff --git a/test/support/test_helper.rb b/test/support/test_helper.rb index 8c831daa..ec9d5c30 100644 --- a/test/support/test_helper.rb +++ b/test/support/test_helper.rb @@ -1,8 +1,27 @@ -if ENV['COVERAGE'] +# frozen_string_literal: true + +begin require 'simplecov' + require 'simplecov-console' + require 'codecov' +rescue LoadError +else SimpleCov.start do - add_filter '/test/' + track_files 'lib/**/*.rb' + + add_filter '/test' + + enable_coverage :branch + + # do not track vendored files + add_filter '/vendor' + add_filter '/.vendor' end + + SimpleCov.formatters = [ + SimpleCov::Formatter::Console, + SimpleCov::Formatter::Codecov, + ] end require 'minitest/autorun' From d0742b2176c260b5818821f208c0d5f7a01aef18 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 2 Sep 2021 15:23:45 +0200 Subject: [PATCH 10/22] cleanup CI environment --- .github/workflows/release.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a44a9dac..012f560a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,8 +15,6 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: '3.0' - env: - BUNDLE_WITHOUT: release - name: Build gem run: gem build *.gemspec - name: Publish gem to rubygems.org @@ -29,4 +27,4 @@ jobs: echo ":github: Bearer ${{ secrets.GITHUB_TOKEN }}" >> ~/.gem/credentials chmod 0600 ~/.gem/credentials - name: Publish gem to GitHub packages - run: gem push --key github --host https://rubygems.pkg.github.com/voxpupuli *.gem + run: gem push --key github --host https://rubygems.pkg.github.com/${{ github.repository_owner }} *.gem From f67fe6e2a982b2d6c3ca78a5251add64bf2cd43c Mon Sep 17 00:00:00 2001 From: Laurent Date: Tue, 28 Sep 2021 17:24:09 +0200 Subject: [PATCH 11/22] Call URI.open directly Removes warning: "calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open" --- lib/json-schema/schema/reader.rb | 2 +- lib/json-schema/validator.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/json-schema/schema/reader.rb b/lib/json-schema/schema/reader.rb index a4eb664a..b0c5433a 100644 --- a/lib/json-schema/schema/reader.rb +++ b/lib/json-schema/schema/reader.rb @@ -118,7 +118,7 @@ def accept_file?(pathname) def read_uri(uri) if accept_uri?(uri) - open(uri.to_s).read + URI.open(uri.to_s).read else raise JSON::Schema::ReadRefused.new(uri.to_s, :uri) end diff --git a/lib/json-schema/validator.rb b/lib/json-schema/validator.rb index c439b613..da739fb8 100644 --- a/lib/json-schema/validator.rb +++ b/lib/json-schema/validator.rb @@ -593,7 +593,7 @@ def custom_open(uri) uri = Util::URI.normalized_uri(uri) if uri.is_a?(String) if uri.absolute? && Util::URI::SUPPORTED_PROTOCOLS.include?(uri.scheme) begin - open(uri.to_s).read + URI.open(uri.to_s).read rescue OpenURI::HTTPError, Timeout::Error => e raise JSON::Schema::JsonLoadError, e.message end From 6626f40ac52848028732a2b05c230524bef76a33 Mon Sep 17 00:00:00 2001 From: Tim Date: Sat, 27 Nov 2021 19:29:47 +0100 Subject: [PATCH 12/22] Drop Ruby 2.4 support The codechange is required to work properly on newer Ruby versions, but breaks Ruby 2.4. Since Ruby 2.4 is EoL since a long time it's fine to drop support for it. This also makes it easier to add Ruby 3 support later. --- .github/workflows/test.yml | 1 - README.md | 8 ++++++++ json-schema.gemspec | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0937024e..4bb0c2db 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,6 @@ jobs: fail-fast: false matrix: include: - - ruby: "2.4" - ruby: "2.5" coverage: "yes" env: diff --git a/README.md b/README.md index 5b2750a1..a0d298c4 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,14 @@ default**, so schemas that do not declare a validator using the `$schema` keyword will use Draft-04 now instead of Draft-03. This is the reason for the major version upgrade. +Version 3.0.0 Upgrade Notes +--------------------------- + +All individual changes are documented in the CHANGELOG.md. The biggest change +is that the new version only supports Ruby 2.5 and newer. Take a look into the +gemspec file to see the currently supported Ruby version and also +`.github/workflows/test.yml` to see the Ruby versions we test on. + Installation ------------ diff --git a/json-schema.gemspec b/json-schema.gemspec index 60979a14..41631221 100644 --- a/json-schema.gemspec +++ b/json-schema.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |s| s.files = Dir[ "lib/**/*", "resources/*.json" ] s.require_path = "lib" s.extra_rdoc_files = ["README.md","LICENSE.md"] - s.required_ruby_version = ">= 1.9" + s.required_ruby_version = ">= 2.5" s.license = "MIT" s.required_rubygems_version = ">= 1.8" From bdea0276f112bbcfdb887322d5bb170c6ff75899 Mon Sep 17 00:00:00 2001 From: Luke Rodgers Date: Thu, 20 Jun 2019 23:41:19 -0400 Subject: [PATCH 13/22] Change IPAddr formatter to support ruby 1.9, jruby 1.7 These rubies do not have `IPAddr::InvalidAddressError` defined. --- .github/workflows/test.yml | 2 ++ lib/json-schema/attributes/formats/ip.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4bb0c2db..35406383 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,6 +15,8 @@ jobs: matrix: include: - ruby: "2.5" + - ruby: "2.6" + - ruby: "2.7" coverage: "yes" env: COVERAGE: ${{ matrix.coverage }} diff --git a/lib/json-schema/attributes/formats/ip.rb b/lib/json-schema/attributes/formats/ip.rb index 04b2e3ac..b432969e 100644 --- a/lib/json-schema/attributes/formats/ip.rb +++ b/lib/json-schema/attributes/formats/ip.rb @@ -11,7 +11,7 @@ def self.validate(current_schema, data, fragments, processor, validator, options begin ip = IPAddr.new(data) rescue ArgumentError => e - raise e unless e.message == 'invalid address' + raise e unless e.message.start_with?('invalid address') end family = ip_version == 6 ? Socket::AF_INET6 : Socket::AF_INET From c32e281f462622d7fb098c76dd0ee5d67604e7fa Mon Sep 17 00:00:00 2001 From: Danila Poyarkov Date: Mon, 8 Feb 2021 16:05:09 +0300 Subject: [PATCH 14/22] Allow resolution of fragments with escaped parts --- lib/json-schema/validator.rb | 2 +- test/fragment_resolution_test.rb | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/json-schema/validator.rb b/lib/json-schema/validator.rb index da739fb8..817d4f37 100644 --- a/lib/json-schema/validator.rb +++ b/lib/json-schema/validator.rb @@ -73,7 +73,7 @@ def initialize(schema_data, data, opts={}) def schema_from_fragment(base_schema, fragment) schema_uri = base_schema.uri - fragments = fragment.split("/") + fragments = fragment.split("/").map { |f| f.gsub('~0', '~').gsub('~1', '/') } # ensure the first element was a hash, per the fragment spec if fragments.shift != "#" diff --git a/test/fragment_resolution_test.rb b/test/fragment_resolution_test.rb index 5fe90113..52d6a9e6 100644 --- a/test/fragment_resolution_test.rb +++ b/test/fragment_resolution_test.rb @@ -80,4 +80,21 @@ def test_array_fragment_resolution assert_valid schema, 5, :fragment => "#/properties/a/anyOf/0" refute_valid schema, 5, :fragment => "#/properties/a/anyOf/1" end + + def test_fragment_with_escape_sequences_resolution + schema = { + "content" => { + "application/json" => { + "type" => "object", + "required" => ["a"], + "properties" => { + "a" => {"type" => "integer"} + } + } + } + } + + assert_valid schema, {"a" => 1}, :fragment => "#/content/application~1json" + refute_valid schema, {}, :fragment => "#/content/application~1json" + end end From a4551e5755714e1c076a7357b6a8411f2727e872 Mon Sep 17 00:00:00 2001 From: Doug Patti Date: Fri, 15 Apr 2016 14:44:56 -0400 Subject: [PATCH 15/22] fix fragment when used with extended schema This refactors some of `Validator` to fix an issue with validating a fragment of an extended schema against a json object. The problem is that while navigating through the schema, we are using the configured `:version` option as the validator for each partial schema. This is an issue because if the root of the schema declares a `$schema`, that information is lost in the traversal. The refactor does two things. Firstly, it does not write back into `@options[:version]` and it stops using it outside of the constructor entirely. The only place that should know about this is the initialized schema, and from that point on, the canonical validator should be the schema object's validator since it makes a decision about which to use in its constructor. Now we can reduce complexity by using that validator in the `:validate_schema` option branch. The other place that used `:version` is the `schema_from_fragment` method, which is where the bug exists. What we're doing here, instead of dealing with schemas *and* hashes during the iterator, is pulling the schema object out, digging through it using the fragments, and then wrapping the result in a schema using the `base_schema`'s validator. Tests have been included that demonstrate the problem. --- lib/json-schema/validator.rb | 55 +++++++++++++++--------------------- test/extended_schema_test.rb | 18 ++++++++++++ 2 files changed, 41 insertions(+), 32 deletions(-) diff --git a/lib/json-schema/validator.rb b/lib/json-schema/validator.rb index 817d4f37..c13db4ee 100644 --- a/lib/json-schema/validator.rb +++ b/lib/json-schema/validator.rb @@ -41,8 +41,7 @@ def initialize(schema_data, data, opts={}) @options = @@default_opts.clone.merge(opts) @errors = [] - validator = self.class.validator_for_name(@options[:version]) - @options[:version] = validator + configured_validator = self.class.validator_for_name(@options[:version]) @options[:schema_reader] ||= self.class.schema_reader @validation_options = @options[:record_errors] ? {:record_errors => true} : {} @@ -50,19 +49,16 @@ def initialize(schema_data, data, opts={}) @validation_options[:strict] = true if @options[:strict] == true @validation_options[:clear_cache] = true if !@@cache_schemas || @options[:clear_cache] - @@mutex.synchronize { @base_schema = initialize_schema(schema_data) } + @@mutex.synchronize { @base_schema = initialize_schema(schema_data, configured_validator) } @original_data = data @data = initialize_data(data) @@mutex.synchronize { build_schemas(@base_schema) } # validate the schema, if requested if @options[:validate_schema] - if @base_schema.schema["$schema"] - base_validator = self.class.validator_for_name(@base_schema.schema["$schema"]) - end - metaschema = base_validator ? base_validator.metaschema : validator.metaschema # Don't clear the cache during metaschema validation! - self.class.validate!(metaschema, @base_schema.schema, {:clear_cache => false}) + meta_validator = self.class.new(@base_schema.validator.metaschema, @base_schema.schema, {:clear_cache => false}) + meta_validator.validate end # If the :fragment option is set, try and validate against the fragment @@ -80,33 +76,28 @@ def schema_from_fragment(base_schema, fragment) raise JSON::Schema::SchemaError.new("Invalid fragment syntax in :fragment option") end + schema_fragment = base_schema.schema fragments.each do |f| - if base_schema.is_a?(JSON::Schema) #test if fragment is a JSON:Schema instance - if !base_schema.schema.has_key?(f) - raise JSON::Schema::SchemaError.new("Invalid fragment resolution for :fragment option") - end - base_schema = base_schema.schema[f] - elsif base_schema.is_a?(Hash) - if !base_schema.has_key?(f) - raise JSON::Schema::SchemaError.new("Invalid fragment resolution for :fragment option") - end - base_schema = JSON::Schema.new(base_schema[f],schema_uri,@options[:version]) - elsif base_schema.is_a?(Array) - if base_schema[f.to_i].nil? - raise JSON::Schema::SchemaError.new("Invalid fragment resolution for :fragment option") - end - base_schema = JSON::Schema.new(base_schema[f.to_i],schema_uri,@options[:version]) - else - raise JSON::Schema::SchemaError.new("Invalid schema encountered when resolving :fragment option") + case schema_fragment + when Hash + schema_fragment = schema_fragment[f] + when Array + schema_fragment = schema_fragment[f.to_i] end end + unless schema_fragment.is_a?(Hash) + raise JSON::Schema::SchemaError.new("Invalid fragment resolution for :fragment option") + end + + schema = JSON::Schema.new(schema_fragment, schema_uri, base_schema.validator) + if @options[:list] - base_schema.to_array_schema - elsif base_schema.is_a?(Hash) - JSON::Schema.new(base_schema, schema_uri, @options[:version]) + schema.to_array_schema + elsif schema.is_a?(Hash) + JSON::Schema.new(schema, schema_uri, @options[:version]) else - base_schema + schema end end @@ -519,12 +510,12 @@ def fake_uuid schema @@fake_uuid_generator.call(schema) end - def initialize_schema(schema) + def initialize_schema(schema, default_validator) if schema.is_a?(String) begin # Build a fake URI for this schema_uri = JSON::Util::URI.parse(fake_uuid(schema)) - schema = JSON::Schema.new(self.class.parse(schema), schema_uri, @options[:version]) + schema = JSON::Schema.new(JSON::Validator.parse(schema), schema_uri, default_validator) if @options[:list] && @options[:fragment].nil? schema = schema.to_array_schema end @@ -554,7 +545,7 @@ def initialize_schema(schema) elsif schema.is_a?(Hash) schema_uri = JSON::Util::URI.parse(fake_uuid(serialize(schema))) schema = JSON::Schema.stringify(schema) - schema = JSON::Schema.new(schema, schema_uri, @options[:version]) + schema = JSON::Schema.new(schema, schema_uri, default_validator) if @options[:list] && @options[:fragment].nil? schema = schema.to_array_schema end diff --git a/test/extended_schema_test.rb b/test/extended_schema_test.rb index beb73ced..ce22f609 100644 --- a/test/extended_schema_test.rb +++ b/test/extended_schema_test.rb @@ -42,6 +42,24 @@ def test_extended_schema_validation refute_valid schema, {"a" => 1, "b" => 5} end + def test_extended_schema_validation_with_fragment + schema = { + "$schema" => "http://test.com/test.json", + "definitions" => { + "odd-a" => { + "properties" => { + "a" => { + "bitwise-and" => 1 + } + } + } + } + } + + assert_valid schema, {"a" => 1}, :fragment => "#/definitions/odd-a" + refute_valid schema, {"a" => 0}, :fragment => "#/definitions/odd-a" + end + def test_unextended_schema # Verify that using the original schema disregards the `bitwise-and` property schema = { From 948ff6ccf5f18f0a6b0aa6f52e8a7ff6e2c58844 Mon Sep 17 00:00:00 2001 From: Zach Dennis Date: Mon, 1 Apr 2019 10:45:03 -0400 Subject: [PATCH 16/22] Updating common test-suite --- test/test-suite | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-suite b/test/test-suite index da8b14ee..15ba997f 160000 --- a/test/test-suite +++ b/test/test-suite @@ -1 +1 @@ -Subproject commit da8b14eef365886cac3caba5d6d995db3e02544e +Subproject commit 15ba997f9b937150a0ab88244d1d0fbf58526c48 From 2f6bc2176b14bcc543b69a1989c86f293585df12 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 16 Feb 2022 21:04:34 +0100 Subject: [PATCH 17/22] Add Ruby 3.0 to CI matrix --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 35406383..b0d038b1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,6 +17,7 @@ jobs: - ruby: "2.5" - ruby: "2.6" - ruby: "2.7" + - ruby: "3.0" coverage: "yes" env: COVERAGE: ${{ matrix.coverage }} From 7937677be44c4a7afd4e4cb781329ca600865b19 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 16 Feb 2022 20:59:03 +0100 Subject: [PATCH 18/22] json-schema.gemspec: Raise required ruby version to 2.5 That's the version we currently test on. --- json-schema.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json-schema.gemspec b/json-schema.gemspec index 41631221..efb80bbe 100644 --- a/json-schema.gemspec +++ b/json-schema.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| s.extra_rdoc_files = ["README.md","LICENSE.md"] s.required_ruby_version = ">= 2.5" s.license = "MIT" - s.required_rubygems_version = ">= 1.8" + s.required_rubygems_version = ">= 2.5" s.add_development_dependency "rake" s.add_development_dependency "minitest", '~> 5.0' From 68f3746d0ad2f2765ac6b3d63cee9b6c755282fa Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 16 Feb 2022 21:14:35 +0100 Subject: [PATCH 19/22] Add Ruby 3.1 to CI matrix --- .github/workflows/release.yml | 4 ++-- .github/workflows/test.yml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 012f560a..91983871 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,10 +11,10 @@ jobs: if: github.repository_owner == 'voxpupuli' steps: - uses: actions/checkout@v2 - - name: Install Ruby 3.0 + - name: Install Ruby 3.1 uses: ruby/setup-ruby@v1 with: - ruby-version: '3.0' + ruby-version: '3.1' - name: Build gem run: gem build *.gemspec - name: Publish gem to rubygems.org diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b0d038b1..95b08e52 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,6 +18,7 @@ jobs: - ruby: "2.6" - ruby: "2.7" - ruby: "3.0" + - ruby: "3.1" coverage: "yes" env: COVERAGE: ${{ matrix.coverage }} From 6b9f2214282db8ec838bc9a9fb94d091b14b1872 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 16 Feb 2022 21:27:58 +0100 Subject: [PATCH 20/22] Add jruby/truffleruby to CI Reimplements https://github.com/voxpupuli/json-schema/pull/447 --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 95b08e52..6a76de36 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,9 @@ jobs: fail-fast: false matrix: include: + - ruby: truffleruby + - ruby: truffleruby+graalvm + - ruby: jruby - ruby: "2.5" - ruby: "2.6" - ruby: "2.7" From 25e258b02f99e16cd2403657ad8b584594b75740 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Laval?= Date: Tue, 15 Mar 2022 13:52:21 -0400 Subject: [PATCH 21/22] Add const attribute support (https://json-schema.org/understanding-json-schema/reference/generic.html#constant-values) --- lib/json-schema/attributes/const.rb | 15 +++++++++++++++ lib/json-schema/validators/draft6.rb | 1 + test/draft6_test.rb | 24 ++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 lib/json-schema/attributes/const.rb create mode 100644 test/draft6_test.rb diff --git a/lib/json-schema/attributes/const.rb b/lib/json-schema/attributes/const.rb new file mode 100644 index 00000000..4c7219b1 --- /dev/null +++ b/lib/json-schema/attributes/const.rb @@ -0,0 +1,15 @@ +require 'json-schema/attribute' + +module JSON + class Schema + class ConstAttribute < Attribute + def self.validate(current_schema, data, fragments, processor, validator, options = {}) + const_value = current_schema.schema['const'] + unless const_value == data + message = "The property '#{build_fragment(fragments)}' value #{data.inspect} did not match constant '#{const_value}'" + validation_error(processor, message, fragments, current_schema, self, options[:record_errors]) + end + end + end + end +end diff --git a/lib/json-schema/validators/draft6.rb b/lib/json-schema/validators/draft6.rb index cd748dfe..55780792 100644 --- a/lib/json-schema/validators/draft6.rb +++ b/lib/json-schema/validators/draft6.rb @@ -34,6 +34,7 @@ def initialize "additionalItems" => JSON::Schema::AdditionalItemsAttribute, "dependencies" => JSON::Schema::DependenciesV4Attribute, "extends" => JSON::Schema::ExtendsAttribute, + "const" => JSON::Schema::ConstAttribute, "$ref" => JSON::Schema::RefAttribute } @default_formats = { diff --git a/test/draft6_test.rb b/test/draft6_test.rb new file mode 100644 index 00000000..eba6d4c2 --- /dev/null +++ b/test/draft6_test.rb @@ -0,0 +1,24 @@ +# encoding: utf-8 +require File.expand_path('../support/test_helper', __FILE__) + +class Draft6Test < Minitest::Test + def validation_errors(schema, data, options) + super(schema, data, :version => :draft6) + end + + def test_const_attribute + schema = { + "type" => "object", + "properties" => { + "a" => {"const" => "foo"}, + "b" => {"const" => 6}, + } + } + + data = {:a => "foo", :b => 6} + assert_valid schema, data + + data = {:a => 6, :b => "foo"} + refute_valid schema, data + end +end From 549bf1993819110b6c95996f960f7f232263d786 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 16 Feb 2022 22:08:23 +0100 Subject: [PATCH 22/22] Release 3.0.0 --- CHANGELOG.md | 711 +++++++++++++++++++++++++++++++++++++++++++++++---- README.md | 6 +- Rakefile | 14 + VERSION.yml | 6 +- 4 files changed, 675 insertions(+), 62 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 334a431a..70850896 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,76 +1,675 @@ -# Change Log -All notable changes to this project will be documented in this file. -Please keep to the changelog format described on [keepachangelog.com](http://keepachangelog.com). -This project adheres to [Semantic Versioning](http://semver.org/). +# Changelog -## [Unreleased] +## [v3.0.0](https://github.com/voxpupuli/json-schema/tree/v3.0.0) (2022-02-16) -## [2.8.1] - 2018-10-14 +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/v2.8.1...v3.0.0) -### Changed -- All limit classes are now stored in their own files in 'json-schema/attributes/limits' -- All attribute classes are now stored in their own files in 'json-schema/attributes' +**Breaking changes:** -### Fixed -- Corrected the draft6 schema id to `http://json-schema.org/draft/schema#` -- Rescue URI error when initializing a data string that contains a colon -- Fragments with an odd number of components no longer raise an `undefined method `validate'` - error -- Loading data from a url no longer raises a "uninitialized constant JSON::Validator::Timeout" error +- json-schema.gemspec: Raise required ruby version to 2.5 [\#466](https://github.com/voxpupuli/json-schema/pull/466) ([bastelfreak](https://github.com/bastelfreak)) +- Call URI.open directly / Drop Ruby 2.4 support [\#462](https://github.com/voxpupuli/json-schema/pull/462) ([bastelfreak](https://github.com/bastelfreak)) -## [2.8.0] - 2017-02-07 +**Implemented enhancements:** -### Added -- Ruby 2.4 support +- Add const attribute support [\#471](https://github.com/voxpupuli/json-schema/pull/471) ([jeremie-stripe](https://github.com/jeremie-stripe))) +- Add truffleruby/jruby to CI [\#469](https://github.com/voxpupuli/json-schema/pull/469) ([bastelfreak](https://github.com/bastelfreak)) +- Add Ruby 3.1 to CI matrix [\#468](https://github.com/voxpupuli/json-schema/pull/468) ([bastelfreak](https://github.com/bastelfreak)) +- Add Ruby 3.0 to CI matrix [\#467](https://github.com/voxpupuli/json-schema/pull/467) ([bastelfreak](https://github.com/bastelfreak)) +- Allow resolution of fragments with escaped parts [\#463](https://github.com/voxpupuli/json-schema/pull/463) ([bastelfreak](https://github.com/bastelfreak)) +- Add Ruby 2.6/2.7 support [\#457](https://github.com/voxpupuli/json-schema/pull/457) ([bastelfreak](https://github.com/bastelfreak)) -### Changed -- Made the `:clear_cache` option for `validate` also clear the URI parse cache -- Moved `JSON::Validator.absolutize_ref` and the ref manipulating code in - `JSON::Schema::RefAttribute` into `JSON::Util::URI` -- Made validation errors refer to json schema types not ruby types +**Fixed bugs:** -### Deprecated -- `JSON::Validator#validator_for` in favor of `JSON::Validator#validator_for_uri` -- `JSON::Validator.validate2` in favor of `JSON::Validator.validate!` -- `JSON::Schema::Validator#extend_schema_definition` in favour of subclassing +- Bugfix: Fix fragment when used with extended schema [\#464](https://github.com/voxpupuli/json-schema/pull/464) ([bastelfreak](https://github.com/bastelfreak)) -## [2.7.0] - 2016-09-29 +**Closed issues:** -### Fixed -- Made sure we really do clear the cache when instructed to -- It's now possible to use reserved words in property names -- Removed support for setting "extends" to a string (it's invalid json-schema - use a "$ref" instead) -- Relaxed 'items' and 'allowedItems' validation to permit arrays to pass even - when they contain fewer elements than the 'items' array. To require full tuples, - use 'minItems'. +- Failure/Error: require 'json-schema-rspec', cannot load such file -- multi\_json [\#448](https://github.com/voxpupuli/json-schema/issues/448) +- Allow type or null? [\#441](https://github.com/voxpupuli/json-schema/issues/441) +- type for NilClass [\#428](https://github.com/voxpupuli/json-schema/issues/428) +- It would be very useful if the required property name was included in the error object [\#417](https://github.com/voxpupuli/json-schema/issues/417) +- Uninitialized constant JSON::Validator::Timeout [\#384](https://github.com/voxpupuli/json-schema/issues/384) -### Changed -- Made all `validate*` methods on `JSON::Validator` ultimately call `validate!` -- Updated addressable dependency to 2.4.0 -- Attached failed `uri` or `pathname` to read errors for more meaning +**Merged pull requests:** -## [2.6.2] - 2016-05-13 +- update README.md/gemspec; migrate to GitHub actions [\#456](https://github.com/voxpupuli/json-schema/pull/456) ([bastelfreak](https://github.com/bastelfreak)) +- Update json-schema.gemspec; require addressable 2.8 and newer [\#455](https://github.com/voxpupuli/json-schema/pull/455) ([ahsandar](https://github.com/ahsandar)) +- Update README.md [\#444](https://github.com/voxpupuli/json-schema/pull/444) ([cagmz](https://github.com/cagmz)) +- Load VERSION.yml from relative path, so that developers can use "bundle config local.json-schema" [\#419](https://github.com/voxpupuli/json-schema/pull/419) ([ndbroadbent](https://github.com/ndbroadbent)) +- Fix typo in Changelog \(2019 =\> 2018\) [\#418](https://github.com/voxpupuli/json-schema/pull/418) ([ndbroadbent](https://github.com/ndbroadbent)) +- Made sure we require timeout before using it [\#385](https://github.com/voxpupuli/json-schema/pull/385) ([iainbeeston](https://github.com/iainbeeston)) +- webmock 3 drops ruby 1.9 support; specify this in its gemfile [\#383](https://github.com/voxpupuli/json-schema/pull/383) ([notEthan](https://github.com/notEthan)) +- Refactor common test suite [\#377](https://github.com/voxpupuli/json-schema/pull/377) ([iainbeeston](https://github.com/iainbeeston)) +- Corrected the draf6 schema id [\#376](https://github.com/voxpupuli/json-schema/pull/376) ([iainbeeston](https://github.com/iainbeeston)) +- Added a rake task to automatically download the latest metaschemas [\#375](https://github.com/voxpupuli/json-schema/pull/375) ([iainbeeston](https://github.com/iainbeeston)) +- Re-enabled test warnings [\#374](https://github.com/voxpupuli/json-schema/pull/374) ([iainbeeston](https://github.com/iainbeeston)) +- Fix for string invalid scheme error when string contains colon [\#373](https://github.com/voxpupuli/json-schema/pull/373) ([benSlaughter](https://github.com/benSlaughter)) +- Added simplecov [\#343](https://github.com/voxpupuli/json-schema/pull/343) ([iainbeeston](https://github.com/iainbeeston)) +- Extracted all limits out to their own file [\#342](https://github.com/voxpupuli/json-schema/pull/342) ([iainbeeston](https://github.com/iainbeeston)) +- Fixes for 1.9 [\#1](https://github.com/voxpupuli/json-schema/pull/1) ([jarib](https://github.com/jarib)) -### Fixed -- Made it possible to include colons in a $ref +## [v2.8.1](https://github.com/voxpupuli/json-schema/tree/v2.8.1) (2018-10-14) -### Changed -- Reformatted examples in the readme +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/v2.8.0...v2.8.1) -## [2.6.1] - 2016-02-26 +**Closed issues:** -### Fixed -- Made sure schemas of an unrecognized type raise a SchemaParseError (not Name error) +- Version 2.8.1 Patch release? [\#415](https://github.com/voxpupuli/json-schema/issues/415) +- possible to enforce schema ? [\#410](https://github.com/voxpupuli/json-schema/issues/410) +- undefined method `each' for "\":String [\#409](https://github.com/voxpupuli/json-schema/issues/409) +- Documentation Request: How do I validate the schema itself? [\#398](https://github.com/voxpupuli/json-schema/issues/398) +- :errors\_as\_objects can never be false in base\_schema.validate [\#392](https://github.com/voxpupuli/json-schema/issues/392) +- too complex [\#390](https://github.com/voxpupuli/json-schema/issues/390) +- Release 2.8.0 of the gem is missing a tag in the repo [\#389](https://github.com/voxpupuli/json-schema/issues/389) +- Remove trailing whitespaces [\#378](https://github.com/voxpupuli/json-schema/issues/378) +- Failure on 'allOf' validation message output is too generic [\#320](https://github.com/voxpupuli/json-schema/issues/320) -### Changed -- Readme was converted from textile to markdown +## [v2.8.0](https://github.com/voxpupuli/json-schema/tree/v2.8.0) (2017-02-07) -## [2.6.0] - 2016-01-08 +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/v2.7.0...v2.8.0) -### Added -- Added a changelog +**Closed issues:** -### Changed -- Improved performance by caching the parsing and normalization of URIs -- Made validation failures raise a `JSON::Schema::SchemaParseError` and data - loading failures a `JSON::Schema::JsonLoadError` +- JSON::Validator.fully\_validate\(filename, data\) fails when trying to parse filename as JSON [\#366](https://github.com/voxpupuli/json-schema/issues/366) +- 2.7.0 fails validating not required fields [\#364](https://github.com/voxpupuli/json-schema/issues/364) +- Unable to activate json-schema-2.6.2, because addressable-2.4.0 conflicts with addressable \(~\> 2.3.8\) [\#356](https://github.com/voxpupuli/json-schema/issues/356) +- Missing comma after empty array not detected as invalid [\#352](https://github.com/voxpupuli/json-schema/issues/352) +- JSON::Util::URI.parse memory leak [\#329](https://github.com/voxpupuli/json-schema/issues/329) +- additionalProperties is tested and implemented incorrectly [\#321](https://github.com/voxpupuli/json-schema/issues/321) + +**Merged pull requests:** + +- Updated ruby versions for travis [\#372](https://github.com/voxpupuli/json-schema/pull/372) ([iainbeeston](https://github.com/iainbeeston)) +- Load local copy of draft schemas [\#362](https://github.com/voxpupuli/json-schema/pull/362) ([iainbeeston](https://github.com/iainbeeston)) +- Made sure clear\_cache also clears the cache of parsed uris [\#361](https://github.com/voxpupuli/json-schema/pull/361) ([iainbeeston](https://github.com/iainbeeston)) +- Simplified `#validator_for` methods [\#346](https://github.com/voxpupuli/json-schema/pull/346) ([iainbeeston](https://github.com/iainbeeston)) +- Moved Validator\#absolutized\_uri and RefAttribute's ref parsing into the URI module [\#345](https://github.com/voxpupuli/json-schema/pull/345) ([iainbeeston](https://github.com/iainbeeston)) +- Deprecated `JSON::Validator#validate2` [\#336](https://github.com/voxpupuli/json-schema/pull/336) ([iainbeeston](https://github.com/iainbeeston)) +- Deprecated \#extend\_schema\_definition [\#335](https://github.com/voxpupuli/json-schema/pull/335) ([iainbeeston](https://github.com/iainbeeston)) +- Use self or self.class rather than fully qualified class names [\#333](https://github.com/voxpupuli/json-schema/pull/333) ([iainbeeston](https://github.com/iainbeeston)) +- Stopped the additional properties test from using class\_eval [\#332](https://github.com/voxpupuli/json-schema/pull/332) ([iainbeeston](https://github.com/iainbeeston)) + +## [v2.7.0](https://github.com/voxpupuli/json-schema/tree/v2.7.0) (2016-09-29) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/v2.6.2...v2.7.0) + +**Closed issues:** + +- Test failure due to update in JSON-Schema-Test-Suite [\#357](https://github.com/voxpupuli/json-schema/issues/357) +- addressable conflict [\#355](https://github.com/voxpupuli/json-schema/issues/355) +- String "uri" format validation doesn't work [\#353](https://github.com/voxpupuli/json-schema/issues/353) +- How I can set string format by uri or email? [\#351](https://github.com/voxpupuli/json-schema/issues/351) +- Whitelisting properties [\#331](https://github.com/voxpupuli/json-schema/issues/331) +- How to build a complex schema when using with Rails [\#328](https://github.com/voxpupuli/json-schema/issues/328) +- Issues validating objects with oneOf [\#327](https://github.com/voxpupuli/json-schema/issues/327) +- Trouble with Oj parser on parse error [\#305](https://github.com/voxpupuli/json-schema/issues/305) +- tests failing with ruby 2.2 uninitialized constant JSONSchemaDraft1Test::ArrayValidation \(NameError\) [\#262](https://github.com/voxpupuli/json-schema/issues/262) + +**Merged pull requests:** + +- Made it possible to have a property named "$ref" [\#360](https://github.com/voxpupuli/json-schema/pull/360) ([iainbeeston](https://github.com/iainbeeston)) +- Use latest json-schema draft in tests by default [\#359](https://github.com/voxpupuli/json-schema/pull/359) ([iainbeeston](https://github.com/iainbeeston)) +- Restricted the ruby 1.9 build to json \< 2 [\#350](https://github.com/voxpupuli/json-schema/pull/350) ([iainbeeston](https://github.com/iainbeeston)) +- Item partial tuples [\#348](https://github.com/voxpupuli/json-schema/pull/348) ([jlfaber](https://github.com/jlfaber)) +- Removed the ruby 1.8 build from travis [\#340](https://github.com/voxpupuli/json-schema/pull/340) ([iainbeeston](https://github.com/iainbeeston)) +- Made sure all validate methods go through the same call chain [\#338](https://github.com/voxpupuli/json-schema/pull/338) ([iainbeeston](https://github.com/iainbeeston)) +- Fixed issues with caching [\#334](https://github.com/voxpupuli/json-schema/pull/334) ([iainbeeston](https://github.com/iainbeeston)) +- Allow addressable 2.4+ to work with json-schema [\#312](https://github.com/voxpupuli/json-schema/pull/312) ([iainbeeston](https://github.com/iainbeeston)) +- Tidy up tests [\#290](https://github.com/voxpupuli/json-schema/pull/290) ([iainbeeston](https://github.com/iainbeeston)) + +## [v2.6.2](https://github.com/voxpupuli/json-schema/tree/v2.6.2) (2016-05-13) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/v2.6.1...v2.6.2) + +**Closed issues:** + +- "required" array in sub schema not being checked [\#325](https://github.com/voxpupuli/json-schema/issues/325) +- optional attributes are not being parsed as optional [\#324](https://github.com/voxpupuli/json-schema/issues/324) +- JSON pointers are broken when they contain a `:` [\#319](https://github.com/voxpupuli/json-schema/issues/319) +- MultiJSON receives filepath instead of its content [\#318](https://github.com/voxpupuli/json-schema/issues/318) +- Chef DK installs addressable 2.4.0 which conflicts with the requirement for 2.3.8 for json-schema [\#317](https://github.com/voxpupuli/json-schema/issues/317) +- Empty array \(incorrectly?\) triggering ValidationError [\#311](https://github.com/voxpupuli/json-schema/issues/311) + +**Merged pull requests:** + +- Made it possible to have refs that include URI-special characters [\#322](https://github.com/voxpupuli/json-schema/pull/322) ([iainbeeston](https://github.com/iainbeeston)) +- Reformatted the examples to make them easier to read [\#316](https://github.com/voxpupuli/json-schema/pull/316) ([iainbeeston](https://github.com/iainbeeston)) + +## [v2.6.1](https://github.com/voxpupuli/json-schema/tree/v2.6.1) (2016-02-26) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/v2.6.0...v2.6.1) + +**Closed issues:** + +- uninitialized constant JSON::Validator::SchemaParseError [\#307](https://github.com/voxpupuli/json-schema/issues/307) +- How can I perform more complex validations [\#306](https://github.com/voxpupuli/json-schema/issues/306) +- `fully_validate` // `anyOf`, `typeOf`, `allOf` don't raise validation errors when using `record_errors: true` [\#300](https://github.com/voxpupuli/json-schema/issues/300) +- Feature Request: provide ref-like path for allOf/oneOf matches if validation fails. [\#298](https://github.com/voxpupuli/json-schema/issues/298) +- NameError: uninitialized constant JSON::Validator::SchemaParseError [\#292](https://github.com/voxpupuli/json-schema/issues/292) +- oneOf and patternProperties validates incorrectly [\#291](https://github.com/voxpupuli/json-schema/issues/291) +- Validate a schema [\#287](https://github.com/voxpupuli/json-schema/issues/287) + +**Merged pull requests:** + +- Update README.md [\#308](https://github.com/voxpupuli/json-schema/pull/308) ([cassidycodes](https://github.com/cassidycodes)) +- Convert readme to markdown [\#302](https://github.com/voxpupuli/json-schema/pull/302) ([lencioni](https://github.com/lencioni)) +- Made sure we include the module name for SchemaParseErrors [\#293](https://github.com/voxpupuli/json-schema/pull/293) ([iainbeeston](https://github.com/iainbeeston)) + +## [v2.6.0](https://github.com/voxpupuli/json-schema/tree/v2.6.0) (2016-01-08) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/v2.5.2...v2.6.0) + +**Closed issues:** + +- How to validate data with only part of my schema [\#288](https://github.com/voxpupuli/json-schema/issues/288) +- Addressable::Uri does not raise error on invalid strings [\#282](https://github.com/voxpupuli/json-schema/issues/282) +- typeOf array doesn't validate references [\#281](https://github.com/voxpupuli/json-schema/issues/281) +- register\_format\_validator doesn't add format to @@default\_validator [\#276](https://github.com/voxpupuli/json-schema/issues/276) +- JSON API 1.0 Support [\#272](https://github.com/voxpupuli/json-schema/issues/272) + +**Merged pull requests:** + +- Remove ruby warnings [\#286](https://github.com/voxpupuli/json-schema/pull/286) ([teoljungberg](https://github.com/teoljungberg)) +- Redux: speed up JSON::Validator.validate [\#285](https://github.com/voxpupuli/json-schema/pull/285) ([iainbeeston](https://github.com/iainbeeston)) +- Test all versions in test\_custom\_format [\#278](https://github.com/voxpupuli/json-schema/pull/278) ([jpmckinney](https://github.com/jpmckinney)) +- Update README.textile to fix schema validation example [\#271](https://github.com/voxpupuli/json-schema/pull/271) ([mkonecny](https://github.com/mkonecny)) +- Only rescue errors explicitly [\#239](https://github.com/voxpupuli/json-schema/pull/239) ([iainbeeston](https://github.com/iainbeeston)) + +## [v2.5.2](https://github.com/voxpupuli/json-schema/tree/v2.5.2) (2015-11-24) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/v2.5.1...v2.5.2) + +**Closed issues:** + +- Properties as Property not working [\#273](https://github.com/voxpupuli/json-schema/issues/273) +- Schema nesting with id key is not validating as expected [\#270](https://github.com/voxpupuli/json-schema/issues/270) +- Does not validate email correctly... [\#269](https://github.com/voxpupuli/json-schema/issues/269) +- No implicit conversion of integer [\#259](https://github.com/voxpupuli/json-schema/issues/259) +- No implicit conversion of integer to string with links [\#258](https://github.com/voxpupuli/json-schema/issues/258) +- Automatically parse number values [\#257](https://github.com/voxpupuli/json-schema/issues/257) +- Does not fail for type number when the data is string [\#251](https://github.com/voxpupuli/json-schema/issues/251) +- Prepare release of 2.5.1 [\#228](https://github.com/voxpupuli/json-schema/issues/228) +- Unable to set clear\_cache option [\#225](https://github.com/voxpupuli/json-schema/issues/225) +- Incorrect exception message in 2.5.0 [\#220](https://github.com/voxpupuli/json-schema/issues/220) +- Trouble with forbidden additionalProperties and one/any/allOf? [\#161](https://github.com/voxpupuli/json-schema/issues/161) + +**Merged pull requests:** + +- register\_format\_validator on default\_validator [\#277](https://github.com/voxpupuli/json-schema/pull/277) ([jpmckinney](https://github.com/jpmckinney)) +- Explicitly notes :strict overrides any required properties set in schema [\#252](https://github.com/voxpupuli/json-schema/pull/252) ([KTKate](https://github.com/KTKate)) +- Use old hash syntax in tests [\#240](https://github.com/voxpupuli/json-schema/pull/240) ([iainbeeston](https://github.com/iainbeeston)) +- Allow boolean false as a default property. [\#238](https://github.com/voxpupuli/json-schema/pull/238) ([chrisandreae](https://github.com/chrisandreae)) +- Removed test files from gemspec [\#237](https://github.com/voxpupuli/json-schema/pull/237) ([iainbeeston](https://github.com/iainbeeston)) +- Expose clear\_cache option [\#235](https://github.com/voxpupuli/json-schema/pull/235) ([danieldraper](https://github.com/danieldraper)) +- Enabled warnings when running tests [\#231](https://github.com/voxpupuli/json-schema/pull/231) ([iainbeeston](https://github.com/iainbeeston)) + +## [v2.5.1](https://github.com/voxpupuli/json-schema/tree/v2.5.1) (2015-02-23) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/v2.5.0...v2.5.1) + +**Closed issues:** + +- Passing in a fragment with an even number of tokens can lead to undefined method `validate' for \#\ [\#265](https://github.com/voxpupuli/json-schema/issues/265) +- Absoluteness correction [\#233](https://github.com/voxpupuli/json-schema/issues/233) +- Consider releasing 2.5.1 [\#227](https://github.com/voxpupuli/json-schema/issues/227) + +**Merged pull requests:** + +- Ignore fragments in schema caching. Fixes \#233 [\#234](https://github.com/voxpupuli/json-schema/pull/234) ([jphastings](https://github.com/jphastings)) +- Only add violating properties to error message for strict validation [\#230](https://github.com/voxpupuli/json-schema/pull/230) ([RST-J](https://github.com/RST-J)) +- Show sub-errors for oneOf [\#216](https://github.com/voxpupuli/json-schema/pull/216) ([isage](https://github.com/isage)) +- Update README - latest version is currently 2.5.0 [\#215](https://github.com/voxpupuli/json-schema/pull/215) ([take](https://github.com/take)) +- End single quote in validation error [\#213](https://github.com/voxpupuli/json-schema/pull/213) ([olleolleolle](https://github.com/olleolleolle)) +- add description for nested types array and object [\#212](https://github.com/voxpupuli/json-schema/pull/212) ([brancz](https://github.com/brancz)) +- Updated to addressable 2.3.7 [\#226](https://github.com/voxpupuli/json-schema/pull/226) ([iainbeeston](https://github.com/iainbeeston)) +- Made sure we really do update the common test suite before test runs [\#224](https://github.com/voxpupuli/json-schema/pull/224) ([iainbeeston](https://github.com/iainbeeston)) +- Added Ruby 2.2 to the build matrix [\#223](https://github.com/voxpupuli/json-schema/pull/223) ([iainbeeston](https://github.com/iainbeeston)) +- Renamed variable in oneOf to avoid name clash [\#221](https://github.com/voxpupuli/json-schema/pull/221) ([iainbeeston](https://github.com/iainbeeston)) +- Issue with Fixnum and Float in enum [\#219](https://github.com/voxpupuli/json-schema/pull/219) ([RST-J](https://github.com/RST-J)) + +## [v2.5.0](https://github.com/voxpupuli/json-schema/tree/v2.5.0) (2014-12-03) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/2.4.1...v2.5.0) + +**Closed issues:** + +- additionalProperties and $ref are not working together [\#185](https://github.com/voxpupuli/json-schema/issues/185) +- Dependencies [\#179](https://github.com/voxpupuli/json-schema/issues/179) +- Use Addressable for handling URIs? [\#173](https://github.com/voxpupuli/json-schema/issues/173) +- Full support for the common test suite [\#163](https://github.com/voxpupuli/json-schema/issues/163) +- Remove yajl-Ruby support in favour of multi\_json [\#162](https://github.com/voxpupuli/json-schema/issues/162) +- Drop support for email and hostname formats [\#159](https://github.com/voxpupuli/json-schema/issues/159) +- format: date-time validator isn't leap-second compliant [\#123](https://github.com/voxpupuli/json-schema/issues/123) +- Symbol keys not handled in combination with additionalProperties [\#108](https://github.com/voxpupuli/json-schema/issues/108) +- When extending a schema in folder names with spaces [\#100](https://github.com/voxpupuli/json-schema/issues/100) +- Enhancing schema draft [\#99](https://github.com/voxpupuli/json-schema/issues/99) +- Doesn't work in JRuby \(1.7.10 or 1.7.6\) with --1.8 [\#95](https://github.com/voxpupuli/json-schema/issues/95) +- Support for string "format" attribute [\#79](https://github.com/voxpupuli/json-schema/issues/79) +- Provide secure way of testing [\#77](https://github.com/voxpupuli/json-schema/issues/77) +- Breaks with multi\_json 1.7.9 \(works with 1.7.7\) [\#73](https://github.com/voxpupuli/json-schema/issues/73) +- additionalProperties and extends don't work together [\#31](https://github.com/voxpupuli/json-schema/issues/31) +- Next minor release \(2.5.0\) [\#202](https://github.com/voxpupuli/json-schema/issues/202) + +**Merged pull requests:** + +- Added bundler gem management rake tasks [\#211](https://github.com/voxpupuli/json-schema/pull/211) ([iainbeeston](https://github.com/iainbeeston)) +- Refactored parser error code [\#210](https://github.com/voxpupuli/json-schema/pull/210) ([iainbeeston](https://github.com/iainbeeston)) +- WebMock is on globally now; no need to disable it [\#208](https://github.com/voxpupuli/json-schema/pull/208) ([pd](https://github.com/pd)) +- Addressable spring clean [\#199](https://github.com/voxpupuli/json-schema/pull/199) ([iainbeeston](https://github.com/iainbeeston)) +- Tidied the common test suite tests [\#197](https://github.com/voxpupuli/json-schema/pull/197) ([iainbeeston](https://github.com/iainbeeston)) +- Remove "no dependencies" claim from README [\#194](https://github.com/voxpupuli/json-schema/pull/194) ([pd](https://github.com/pd)) +- Remove unused Schema\#base\_uri method [\#193](https://github.com/voxpupuli/json-schema/pull/193) ([pd](https://github.com/pd)) +- Updated the common test suite [\#191](https://github.com/voxpupuli/json-schema/pull/191) ([iainbeeston](https://github.com/iainbeeston)) +- Use unescape for paths before reading files [\#188](https://github.com/voxpupuli/json-schema/pull/188) ([RST-J](https://github.com/RST-J)) +- Use the new build env on Travis [\#187](https://github.com/voxpupuli/json-schema/pull/187) ([joshk](https://github.com/joshk)) +- `oneOf` and `anyOf` errors where default values are present [\#181](https://github.com/voxpupuli/json-schema/pull/181) ([tonymarklove](https://github.com/tonymarklove)) +- Only stringify schema once [\#180](https://github.com/voxpupuli/json-schema/pull/180) ([treppo](https://github.com/treppo)) +- Refactor ref schema URI construction. [\#177](https://github.com/voxpupuli/json-schema/pull/177) ([gabrielg](https://github.com/gabrielg)) +- Use RFC 2606 reserved invalid DNS name in tests. [\#176](https://github.com/voxpupuli/json-schema/pull/176) ([gabrielg](https://github.com/gabrielg)) +- Use Addressable gem to handle URIs [\#174](https://github.com/voxpupuli/json-schema/pull/174) ([RST-J](https://github.com/RST-J)) +- General cleanup, mostly focused on attributes/\* [\#172](https://github.com/voxpupuli/json-schema/pull/172) ([pd](https://github.com/pd)) +- Extend common-test-suite to ignore individual test cases [\#171](https://github.com/voxpupuli/json-schema/pull/171) ([mpalmer](https://github.com/mpalmer)) +- Added some tests around file uris [\#169](https://github.com/voxpupuli/json-schema/pull/169) ([iainbeeston](https://github.com/iainbeeston)) +- Add some test helpers for common patterns [\#168](https://github.com/voxpupuli/json-schema/pull/168) ([pd](https://github.com/pd)) +- Removed multijson license [\#167](https://github.com/voxpupuli/json-schema/pull/167) ([iainbeeston](https://github.com/iainbeeston)) +- Add mailing list and IRC channel [\#166](https://github.com/voxpupuli/json-schema/pull/166) ([hoxworth](https://github.com/hoxworth)) +- Fix draft3 `disallow` validation [\#165](https://github.com/voxpupuli/json-schema/pull/165) ([pd](https://github.com/pd)) +- Enable refremote specs [\#164](https://github.com/voxpupuli/json-schema/pull/164) ([pd](https://github.com/pd)) +- Fix for relative ref with fragment identifier on Windows [\#109](https://github.com/voxpupuli/json-schema/pull/109) ([jlblcc](https://github.com/jlblcc)) +- Any ref issue [\#200](https://github.com/voxpupuli/json-schema/pull/200) ([RST-J](https://github.com/RST-J)) +- Fix test runs for optional dependencies [\#196](https://github.com/voxpupuli/json-schema/pull/196) ([iainbeeston](https://github.com/iainbeeston)) +- JSON::Schema::Reader [\#175](https://github.com/voxpupuli/json-schema/pull/175) ([pd](https://github.com/pd)) + +## [2.4.1](https://github.com/voxpupuli/json-schema/tree/2.4.1) (2014-10-28) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/2.4.0...2.4.1) + +**Merged pull requests:** + +- Replaced \#add\_indifferent\_access with \#stringify [\#142](https://github.com/voxpupuli/json-schema/pull/142) ([iainbeeston](https://github.com/iainbeeston)) + +## [2.4.0](https://github.com/voxpupuli/json-schema/tree/2.4.0) (2014-10-28) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/2.3.0...2.4.0) + +**Fixed bugs:** + +- Bug in IPV6 format validation [\#133](https://github.com/voxpupuli/json-schema/issues/133) + +**Closed issues:** + +- Path issue when validating draft-04 schema [\#160](https://github.com/voxpupuli/json-schema/issues/160) +- Schema validation is broken in master [\#135](https://github.com/voxpupuli/json-schema/issues/135) +- Dependencies don't seem to work correctly [\#117](https://github.com/voxpupuli/json-schema/issues/117) +- Use common test suite? [\#113](https://github.com/voxpupuli/json-schema/issues/113) +- "Fix symbol keys in data" breaks working implementations [\#96](https://github.com/voxpupuli/json-schema/issues/96) + +**Merged pull requests:** + +- Add yajl, multi\_json and uuidtools to travis [\#157](https://github.com/voxpupuli/json-schema/pull/157) ([iainbeeston](https://github.com/iainbeeston)) +- Store static regexps in constants for re-use [\#156](https://github.com/voxpupuli/json-schema/pull/156) ([pd](https://github.com/pd)) +- Fix metaschema access [\#155](https://github.com/voxpupuli/json-schema/pull/155) ([pd](https://github.com/pd)) +- Add ruby 1.8 to travis [\#154](https://github.com/voxpupuli/json-schema/pull/154) ([iainbeeston](https://github.com/iainbeeston)) +- Enable draft4/dependencies test [\#153](https://github.com/voxpupuli/json-schema/pull/153) ([pd](https://github.com/pd)) +- Add 1.8.7 minimum ruby version to the spec [\#149](https://github.com/voxpupuli/json-schema/pull/149) ([hoxworth](https://github.com/hoxworth)) +- Validator tidy [\#147](https://github.com/voxpupuli/json-schema/pull/147) ([iainbeeston](https://github.com/iainbeeston)) +- Unescape ref fragment pointers [\#146](https://github.com/voxpupuli/json-schema/pull/146) ([pd](https://github.com/pd)) +- Fix schema dep v4 [\#145](https://github.com/voxpupuli/json-schema/pull/145) ([RST-J](https://github.com/RST-J)) +- Update descr [\#144](https://github.com/voxpupuli/json-schema/pull/144) ([RST-J](https://github.com/RST-J)) +- Use IPAddr class to validate ip formats [\#143](https://github.com/voxpupuli/json-schema/pull/143) ([RST-J](https://github.com/RST-J)) +- Added codeclimate badge to readme [\#141](https://github.com/voxpupuli/json-schema/pull/141) ([iainbeeston](https://github.com/iainbeeston)) +- Make intra-doc refs work when validating with :fragment [\#127](https://github.com/voxpupuli/json-schema/pull/127) ([mpalmer](https://github.com/mpalmer)) +- Hyper validation [\#125](https://github.com/voxpupuli/json-schema/pull/125) ([mpalmer](https://github.com/mpalmer)) +- Parse dates using ruby's own date parsing - not regular expressions [\#118](https://github.com/voxpupuli/json-schema/pull/118) ([iainbeeston](https://github.com/iainbeeston)) + +## [2.3.0](https://github.com/voxpupuli/json-schema/tree/2.3.0) (2014-10-26) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/2.2.4...2.3.0) + +**Fixed bugs:** + +- Possible bug: nil items in Array properties are stripped before MinItems validation [\#129](https://github.com/voxpupuli/json-schema/issues/129) +- some questions about addtionalproperties [\#112](https://github.com/voxpupuli/json-schema/issues/112) + +**Closed issues:** + +- Possible bug: wrong expectation of required object property [\#139](https://github.com/voxpupuli/json-schema/issues/139) +- Array Validates Against Schema When It Shouldn't [\#137](https://github.com/voxpupuli/json-schema/issues/137) +- Registration of custom format validators [\#128](https://github.com/voxpupuli/json-schema/issues/128) +- Invalid schema not reported using fully\_validate with a oneOf attribute [\#116](https://github.com/voxpupuli/json-schema/issues/116) +- Errors for required properties do not contain the fragment correctly. [\#115](https://github.com/voxpupuli/json-schema/issues/115) +- Use of String\#each breaks Ruby 1.9 [\#78](https://github.com/voxpupuli/json-schema/issues/78) + +**Merged pull requests:** + +- Do not compact before checking minItems [\#140](https://github.com/voxpupuli/json-schema/pull/140) ([pd](https://github.com/pd)) +- Made validation sub errors indicate where they come from [\#138](https://github.com/voxpupuli/json-schema/pull/138) ([iainbeeston](https://github.com/iainbeeston)) +- Add support for `"required": false` while using draft3 with strict mode [\#134](https://github.com/voxpupuli/json-schema/pull/134) ([bkirz](https://github.com/bkirz)) +- Custom formats [\#132](https://github.com/voxpupuli/json-schema/pull/132) ([RST-J](https://github.com/RST-J)) +- Extract formats into separate classes [\#131](https://github.com/voxpupuli/json-schema/pull/131) ([RST-J](https://github.com/RST-J)) +- Refactor classes and validator accessor methods [\#130](https://github.com/voxpupuli/json-schema/pull/130) ([iainbeeston](https://github.com/iainbeeston)) +- Another allOf ref test, and rename class [\#126](https://github.com/voxpupuli/json-schema/pull/126) ([mpalmer](https://github.com/mpalmer)) +- Fix bad ref test for proxy support [\#124](https://github.com/voxpupuli/json-schema/pull/124) ([mpalmer](https://github.com/mpalmer)) +- Run json-schema.org's common test suite [\#122](https://github.com/voxpupuli/json-schema/pull/122) ([mpalmer](https://github.com/mpalmer)) +- Stopped draft3 from registering itself as the default validator [\#121](https://github.com/voxpupuli/json-schema/pull/121) ([iainbeeston](https://github.com/iainbeeston)) +- Added ruby 2.0, rubinius and jruby to travis build [\#119](https://github.com/voxpupuli/json-schema/pull/119) ([iainbeeston](https://github.com/iainbeeston)) +- Handle non-latin uris [\#114](https://github.com/voxpupuli/json-schema/pull/114) ([iainbeeston](https://github.com/iainbeeston)) +- Remove deprecated :rubygems source from Gemfile [\#111](https://github.com/voxpupuli/json-schema/pull/111) ([jamiecobbett](https://github.com/jamiecobbett)) + +## [2.2.4](https://github.com/voxpupuli/json-schema/tree/2.2.4) (2014-07-19) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/2.2.3...2.2.4) + +**Closed issues:** + +- Not correctly validating: "The property did not match the following type: string in schema" [\#101](https://github.com/voxpupuli/json-schema/issues/101) +- Validator return error when data is an array with hash with symbolic keys [\#94](https://github.com/voxpupuli/json-schema/issues/94) + +**Merged pull requests:** + +- Fix `list:true` when referencing a cached schema [\#107](https://github.com/voxpupuli/json-schema/pull/107) ([pd](https://github.com/pd)) +- Setup travis [\#106](https://github.com/voxpupuli/json-schema/pull/106) ([apsoto](https://github.com/apsoto)) + +## [2.2.3](https://github.com/voxpupuli/json-schema/tree/2.2.3) (2014-07-16) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/1.2.1...2.2.3) + +**Closed issues:** + +- Symbol keys are not supported in objects within arrays [\#104](https://github.com/voxpupuli/json-schema/issues/104) + +**Merged pull requests:** + +- Make hashes in arrays indifferent to string/symbol keys [\#105](https://github.com/voxpupuli/json-schema/pull/105) ([jennyd](https://github.com/jennyd)) +- Load files from namespaced location to avoid conflicts [\#98](https://github.com/voxpupuli/json-schema/pull/98) ([kjg](https://github.com/kjg)) + +## [1.2.1](https://github.com/voxpupuli/json-schema/tree/1.2.1) (2014-01-15) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/2.2.1...1.2.1) + +## [2.2.1](https://github.com/voxpupuli/json-schema/tree/2.2.1) (2014-01-15) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/2.2.0...2.2.1) + +## [2.2.0](https://github.com/voxpupuli/json-schema/tree/2.2.0) (2014-01-15) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/1.2.0...2.2.0) + +## [1.2.0](https://github.com/voxpupuli/json-schema/tree/1.2.0) (2014-01-15) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/2.1.8...1.2.0) + +**Closed issues:** + +- No error when schema not found [\#87](https://github.com/voxpupuli/json-schema/issues/87) +- Schema validation should not clear cache [\#82](https://github.com/voxpupuli/json-schema/issues/82) + +## [2.1.8](https://github.com/voxpupuli/json-schema/tree/2.1.8) (2014-01-04) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/2.1.7...2.1.8) + +**Closed issues:** + +- Enum conversion to a Hash breaks Schema Validation [\#93](https://github.com/voxpupuli/json-schema/issues/93) + +**Merged pull requests:** + +- Fix logic error in format validation [\#80](https://github.com/voxpupuli/json-schema/pull/80) ([jpmckinney](https://github.com/jpmckinney)) + +## [2.1.7](https://github.com/voxpupuli/json-schema/tree/2.1.7) (2014-01-03) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/2.1.6...2.1.7) + +**Closed issues:** + +- Validation still requires data hash keys to be strings. Contrary to most recent version's stated purpose. [\#74](https://github.com/voxpupuli/json-schema/issues/74) + +## [2.1.6](https://github.com/voxpupuli/json-schema/tree/2.1.6) (2014-01-01) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/2.1.5...2.1.6) + +**Closed issues:** + +- Validator takes too long to validate JSON. [\#89](https://github.com/voxpupuli/json-schema/issues/89) +- JSON::Validator.fully\_validate returns error for valid schema with "not" keyword in it [\#84](https://github.com/voxpupuli/json-schema/issues/84) +- JSON::Validator modifies schema object [\#83](https://github.com/voxpupuli/json-schema/issues/83) +- 2.1.2 broke 1.8.7 compatibility [\#62](https://github.com/voxpupuli/json-schema/issues/62) + +## [2.1.5](https://github.com/voxpupuli/json-schema/tree/2.1.5) (2014-01-01) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/2.1.4...2.1.5) + +**Closed issues:** + +- Can you push up the tags? [\#91](https://github.com/voxpupuli/json-schema/issues/91) +- JSON::Validator.default\_validator is being set to draft-03 by default [\#76](https://github.com/voxpupuli/json-schema/issues/76) +- Can't validate with fragment [\#64](https://github.com/voxpupuli/json-schema/issues/64) +- Schema-wide "required" doesn't work [\#61](https://github.com/voxpupuli/json-schema/issues/61) + +## [2.1.4](https://github.com/voxpupuli/json-schema/tree/2.1.4) (2013-12-31) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/2.1.3...2.1.4) + +**Closed issues:** + +- Fat arrow vs colon [\#88](https://github.com/voxpupuli/json-schema/issues/88) +- allOf and $ref not working? [\#86](https://github.com/voxpupuli/json-schema/issues/86) +- Returns "valid" when schema is invalid [\#81](https://github.com/voxpupuli/json-schema/issues/81) +- How to validate schema only? [\#71](https://github.com/voxpupuli/json-schema/issues/71) +- $ref in anyOf, allOf, etc don't work [\#66](https://github.com/voxpupuli/json-schema/issues/66) +- Problem with $ref to validate array property [\#63](https://github.com/voxpupuli/json-schema/issues/63) +- License missing from gemspec [\#60](https://github.com/voxpupuli/json-schema/issues/60) + +**Merged pull requests:** + +- Fix issue 86 [\#92](https://github.com/voxpupuli/json-schema/pull/92) ([sebbacon](https://github.com/sebbacon)) +- Updated date-time regex to accept zero or one of : in the timezone designator [\#85](https://github.com/voxpupuli/json-schema/pull/85) ([jwarykowski](https://github.com/jwarykowski)) +- Fixed fragment resolution. Issue \#64 [\#75](https://github.com/voxpupuli/json-schema/pull/75) ([arcticlcc](https://github.com/arcticlcc)) +- Dont break file scheme with unc on windows [\#72](https://github.com/voxpupuli/json-schema/pull/72) ([kylog](https://github.com/kylog)) +- Fix one of logic [\#70](https://github.com/voxpupuli/json-schema/pull/70) ([apsoto](https://github.com/apsoto)) +- Add Gemfile and ignore Gemfile.lock. [\#68](https://github.com/voxpupuli/json-schema/pull/68) ([ryotarai](https://github.com/ryotarai)) + +## [2.1.3](https://github.com/voxpupuli/json-schema/tree/2.1.3) (2013-08-02) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/2.1.2...2.1.3) + +**Closed issues:** + +- Fail on ruby 1.9.3, jruby 1.6.8 --1.9 [\#45](https://github.com/voxpupuli/json-schema/issues/45) + +**Merged pull requests:** + +- Fix Issue \#66 [\#67](https://github.com/voxpupuli/json-schema/pull/67) ([apsoto](https://github.com/apsoto)) + +## [2.1.2](https://github.com/voxpupuli/json-schema/tree/2.1.2) (2013-07-19) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/2.1.1...2.1.2) + +**Closed issues:** + +- validate\_schema does not use value of $schema [\#59](https://github.com/voxpupuli/json-schema/issues/59) + +## [2.1.1](https://github.com/voxpupuli/json-schema/tree/2.1.1) (2013-07-03) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/2.1.0...2.1.1) + +**Closed issues:** + +- Validate against a schema fragment. [\#56](https://github.com/voxpupuli/json-schema/issues/56) +- 1.0.9 has ruby 1.9.x dependency; breaks patch compatibility [\#44](https://github.com/voxpupuli/json-schema/issues/44) + +## [2.1.0](https://github.com/voxpupuli/json-schema/tree/2.1.0) (2013-07-03) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/2.0.4...2.1.0) + +**Closed issues:** + +- json-schema 2.0.1 broke schema validation [\#58](https://github.com/voxpupuli/json-schema/issues/58) +- maxItems is not working [\#54](https://github.com/voxpupuli/json-schema/issues/54) + +**Merged pull requests:** + +- Add failing test demonstrating failure of complex union type. [\#52](https://github.com/voxpupuli/json-schema/pull/52) ([myronmarston](https://github.com/myronmarston)) + +## [2.0.4](https://github.com/voxpupuli/json-schema/tree/2.0.4) (2013-07-01) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/2.0.3...2.0.4) + +**Closed issues:** + +- ISO 8601 date-times do not include UTC offset [\#42](https://github.com/voxpupuli/json-schema/issues/42) + +**Merged pull requests:** + +- Show schema type in error message instead of ruby class [\#50](https://github.com/voxpupuli/json-schema/pull/50) ([jvatic](https://github.com/jvatic)) + +## [2.0.3](https://github.com/voxpupuli/json-schema/tree/2.0.3) (2013-06-26) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/2.0.2...2.0.3) + +**Merged pull requests:** + +- Fix date-time format. [\#43](https://github.com/voxpupuli/json-schema/pull/43) ([chris-baynes](https://github.com/chris-baynes)) + +## [2.0.2](https://github.com/voxpupuli/json-schema/tree/2.0.2) (2013-06-26) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/2.0.1...2.0.2) + +**Closed issues:** + +- Unable to Validate v4 Schema File [\#57](https://github.com/voxpupuli/json-schema/issues/57) + +**Merged pull requests:** + +- maxitems error message correction [\#55](https://github.com/voxpupuli/json-schema/pull/55) ([lpavan](https://github.com/lpavan)) +- Extends support array of objects too [\#53](https://github.com/voxpupuli/json-schema/pull/53) ([rogerleite](https://github.com/rogerleite)) + +## [2.0.1](https://github.com/voxpupuli/json-schema/tree/2.0.1) (2013-06-25) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/2.0.0...2.0.1) + +**Closed issues:** + +- Support draft v4 [\#51](https://github.com/voxpupuli/json-schema/issues/51) + +## [2.0.0](https://github.com/voxpupuli/json-schema/tree/2.0.0) (2013-06-23) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/1.0.4...2.0.0) + +**Closed issues:** + +- json\_schema with old multi\_json in Rails context [\#39](https://github.com/voxpupuli/json-schema/issues/39) +- Doesn't work with 1.9 stdlib JSON [\#33](https://github.com/voxpupuli/json-schema/issues/33) +- Validation not working on nested properties [\#30](https://github.com/voxpupuli/json-schema/issues/30) +- Add in a validation error structure [\#29](https://github.com/voxpupuli/json-schema/issues/29) +- union types with schemas don't work with :record\_errors =\> true [\#27](https://github.com/voxpupuli/json-schema/issues/27) +- Validator is not thread safe [\#24](https://github.com/voxpupuli/json-schema/issues/24) + +**Merged pull requests:** + +- More descriptive error message for PatternAttribute [\#49](https://github.com/voxpupuli/json-schema/pull/49) ([quoideneuf](https://github.com/quoideneuf)) +- Support \(optional\) adding of default values to input data while validating [\#48](https://github.com/voxpupuli/json-schema/pull/48) ([goodsimon](https://github.com/goodsimon)) +- Restore 1.8.7 compatibility. [\#46](https://github.com/voxpupuli/json-schema/pull/46) ([myronmarston](https://github.com/myronmarston)) +- Extends and additional properties take 2 [\#41](https://github.com/voxpupuli/json-schema/pull/41) ([japgolly](https://github.com/japgolly)) +- Fix Issue with MultiJson Feature Detection [\#40](https://github.com/voxpupuli/json-schema/pull/40) ([tylerhunt](https://github.com/tylerhunt)) +- Extract type validation into a helper method. [\#38](https://github.com/voxpupuli/json-schema/pull/38) ([myronmarston](https://github.com/myronmarston)) +- date-time format and fractional seconds part [\#36](https://github.com/voxpupuli/json-schema/pull/36) ([ILikePies](https://github.com/ILikePies)) +- Play nicely with new and old versions of MultiJson [\#35](https://github.com/voxpupuli/json-schema/pull/35) ([japgolly](https://github.com/japgolly)) +- Validation fails if root data object is a string [\#26](https://github.com/voxpupuli/json-schema/pull/26) ([vapir](https://github.com/vapir)) + +## [1.0.4](https://github.com/voxpupuli/json-schema/tree/1.0.4) (2012-02-14) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/1.0.0...1.0.4) + +**Closed issues:** + +- Extending a schema doesn't allow overrides [\#22](https://github.com/voxpupuli/json-schema/issues/22) + +**Merged pull requests:** + +- Multijson and schema validation [\#28](https://github.com/voxpupuli/json-schema/pull/28) ([myronmarston](https://github.com/myronmarston)) +- Json::Schema::\*Error classes should inherit from StandardError instead of Exception. [\#25](https://github.com/voxpupuli/json-schema/pull/25) ([tommay](https://github.com/tommay)) +- More descriptive error messages [\#23](https://github.com/voxpupuli/json-schema/pull/23) ([zachmargolis](https://github.com/zachmargolis)) + +## [1.0.0](https://github.com/voxpupuli/json-schema/tree/1.0.0) (2012-01-04) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/0.9.12...1.0.0) + +## [0.9.12](https://github.com/voxpupuli/json-schema/tree/0.9.12) (2011-12-14) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/0.9.3...0.9.12) + +**Closed issues:** + +- Validation is slow [\#19](https://github.com/voxpupuli/json-schema/issues/19) +- dependency with string value [\#18](https://github.com/voxpupuli/json-schema/issues/18) +- minLength for non string type [\#17](https://github.com/voxpupuli/json-schema/issues/17) +- Hypermedia schema [\#16](https://github.com/voxpupuli/json-schema/issues/16) +- SimpleUUID::UUID conflicts with simple\_uuid gem [\#11](https://github.com/voxpupuli/json-schema/issues/11) +- UUID class conflict [\#9](https://github.com/voxpupuli/json-schema/issues/9) + +**Merged pull requests:** + +- Fixed Issue \#19 - replace schema.inspect with Yajl::Encoder.encode or Marshal.dump as a fallback [\#20](https://github.com/voxpupuli/json-schema/pull/20) ([kindkid](https://github.com/kindkid)) +- Fixes for validate\_schema [\#15](https://github.com/voxpupuli/json-schema/pull/15) ([dekellum](https://github.com/dekellum)) +- Fix require of attributes and validators to work in Rubinius [\#14](https://github.com/voxpupuli/json-schema/pull/14) ([IPGlider](https://github.com/IPGlider)) +- Gem::Specification::find\_by\_name errors [\#12](https://github.com/voxpupuli/json-schema/pull/12) ([oruen](https://github.com/oruen)) +- removed new rubygems deprecation warnings [\#10](https://github.com/voxpupuli/json-schema/pull/10) ([Vasfed](https://github.com/Vasfed)) + +## [0.9.3](https://github.com/voxpupuli/json-schema/tree/0.9.3) (2011-04-21) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/0.9.2...0.9.3) + +**Closed issues:** + +- typo in lib/json-schema/validator.rb at line 270 [\#8](https://github.com/voxpupuli/json-schema/issues/8) +- Relative URIs are resolved improperly [\#5](https://github.com/voxpupuli/json-schema/issues/5) +- 'format' constraint should not be validated for null values [\#4](https://github.com/voxpupuli/json-schema/issues/4) + +**Merged pull requests:** + +- removed deprecated option has\_rdoc from gemspec [\#7](https://github.com/voxpupuli/json-schema/pull/7) ([Vasfed](https://github.com/Vasfed)) + +## [0.9.2](https://github.com/voxpupuli/json-schema/tree/0.9.2) (2011-03-30) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/0.9.1...0.9.2) + +## [0.9.1](https://github.com/voxpupuli/json-schema/tree/0.9.1) (2011-03-21) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/0.9.0...0.9.1) + +**Closed issues:** + +- Previous draft support [\#2](https://github.com/voxpupuli/json-schema/issues/2) + +**Merged pull requests:** + +- Do not add hash items while iterating over them. [\#3](https://github.com/voxpupuli/json-schema/pull/3) ([oruen](https://github.com/oruen)) + +## [0.9.0](https://github.com/voxpupuli/json-schema/tree/0.9.0) (2011-03-19) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/0.2.0...0.9.0) + +## [0.2.0](https://github.com/voxpupuli/json-schema/tree/0.2.0) (2011-03-09) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/0.1.14...0.2.0) + +## [0.1.14](https://github.com/voxpupuli/json-schema/tree/0.1.14) (2011-03-09) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/0.1.10...0.1.14) + +## [0.1.10](https://github.com/voxpupuli/json-schema/tree/0.1.10) (2011-01-10) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/0.1.6...0.1.10) + +## [0.1.6](https://github.com/voxpupuli/json-schema/tree/0.1.6) (2010-12-03) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/0.1.2...0.1.6) + +## [0.1.2](https://github.com/voxpupuli/json-schema/tree/0.1.2) (2010-11-30) + +[Full Changelog](https://github.com/voxpupuli/json-schema/compare/d1c7b421bbb04d00b06c49e6ebb5ba773d756b12...0.1.2) + + + +\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* diff --git a/README.md b/README.md index a0d298c4..f2756cc9 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Additional Resources -------------------- - [Google Groups](https://groups.google.com/forum/#!forum/ruby-json-schema) -- #ruby-json-schema on chat.freenode.net +- #voxpupuli on irc.libera.chat Version 2.0.0 Upgrade Notes --------------------------- @@ -49,8 +49,8 @@ gem install json-schema From the git repo: ```sh -$ gem build json-schema.gemspec -$ gem install json-schema-2.5.2.gem +gem build json-schema.gemspec +gem install json-schema-*.gem ``` Validation diff --git a/Rakefile b/Rakefile index b4a13a26..26ede98f 100644 --- a/Rakefile +++ b/Rakefile @@ -66,3 +66,17 @@ end task update: [:update_common_tests, :update_meta_schemas] task :default => :test + +begin + require 'rubygems' + require 'github_changelog_generator/task' +rescue LoadError +else + GitHubChangelogGenerator::RakeTask.new :changelog do |config| + config.exclude_labels = %w{duplicate question invalid wontfix wont-fix skip-changelog} + config.user = 'voxpupuli' + config.project = 'json-schema' + gem_version = Gem::Specification.load("#{config.project}.gemspec").version + config.future_release = "v#{gem_version}" + end +end diff --git a/VERSION.yml b/VERSION.yml index dcd73b51..1da88a64 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,3 +1,3 @@ -major: 2 -minor: 8 -patch: 1 +major: 3 +minor: 0 +patch: 0