rack-json_schema 1.1.6 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/CHANGELOG.md +3 -0
- data/README.md +1 -1
- data/Rakefile +4 -0
- data/lib/rack/json_schema/response_validation.rb +5 -5
- data/lib/rack/json_schema/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 76058664ded518126a7217cd15be28a7819f7da4
|
|
4
|
+
data.tar.gz: 47486bee72899be258e35f91fcea32f242c7e690
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d984a9d64ba309d9022f58d29461b5c51934edbe45b86f086120143140daa490d33de4e233f53f99ea89de7be47e418bd2ad668ce867430acebbd94518a20e7d
|
|
7
|
+
data.tar.gz: 54f749aad28fd61b48fef1f642773e102fec1918a716ca906b69f2c39aa7970dbb43f33554a0de333e01f5fc8e01e886e23c12c2c332a02366a8f6116a663a9d
|
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Rack::JsonSchema
|
|
1
|
+
# Rack::JsonSchema [](https://travis-ci.org/r7kamura/rack-json_schema)
|
|
2
2
|
[JSON Schema](http://json-schema.org/) based Rack middlewares.
|
|
3
3
|
|
|
4
4
|
* [Rack::JsonSchema::RequestValidation](#rackjsonschemarequestvalidation)
|
data/Rakefile
CHANGED
|
@@ -31,7 +31,7 @@ module Rack
|
|
|
31
31
|
# Raises an error if any error detected, skipping validation for non-defined link
|
|
32
32
|
# @raise [Rack::JsonSchema::ResponseValidation::InvalidResponse]
|
|
33
33
|
def call
|
|
34
|
-
if !
|
|
34
|
+
if !has_redirection_or_error_status? && has_link_for_current_action? && has_link_of_media_type_json?
|
|
35
35
|
case
|
|
36
36
|
when !has_json_content_type?
|
|
37
37
|
raise InvalidResponseContentType
|
|
@@ -93,10 +93,10 @@ module Rack
|
|
|
93
93
|
@response[0]
|
|
94
94
|
end
|
|
95
95
|
|
|
96
|
-
# Skips validation if status code is equal to or larger than
|
|
97
|
-
# @return [
|
|
98
|
-
def
|
|
99
|
-
response_status >=
|
|
96
|
+
# Skips validation if status code is equal to or larger than 300
|
|
97
|
+
# @return [true, false]
|
|
98
|
+
def has_redirection_or_error_status?
|
|
99
|
+
response_status >= 300
|
|
100
100
|
end
|
|
101
101
|
|
|
102
102
|
# @return [String, nil] Response MIME Type specified in Content-Type header field
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rack-json_schema
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryo Nakamura
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-10-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: erubis
|
|
@@ -187,6 +187,7 @@ extensions: []
|
|
|
187
187
|
extra_rdoc_files: []
|
|
188
188
|
files:
|
|
189
189
|
- ".gitignore"
|
|
190
|
+
- ".travis.yml"
|
|
190
191
|
- CHANGELOG.md
|
|
191
192
|
- Gemfile
|
|
192
193
|
- LICENSE.txt
|