rack-json_schema 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/rack/json_schema/docs.rb +1 -1
- data/lib/rack/json_schema/version.rb +1 -1
- data/spec/fixtures/schema.json +0 -36
- data/spec/rack/spec/docs_spec.rb +11 -0
- data/spec/rack/spec/mock_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a1a86a4622d0d9f2b35d84e2f0bcf398e483eb6
|
4
|
+
data.tar.gz: 93d3efdfddb2b39fb584476b33a12aa0146cc793
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1317f593a583c3a5a325eb4c3eadec87c26ea383ac287487f584e20b654fbdeb48430b0f9c3195c8e6f349a224ea04bcf902beb7c6b47b25e2a9cec95eb00cd6
|
7
|
+
data.tar.gz: bfe7fe3c48dfa2a3cd31e0468055dab86581b23820277d36b0caa87f911ea59e8001b1df8c7b843fc768e7a76cbbcbb23207f5ce264dfde90d3b7662f3d8176c
|
data/CHANGELOG.md
CHANGED
@@ -16,7 +16,7 @@ module Rack
|
|
16
16
|
# Returns rendered document for document request
|
17
17
|
# @param env [Hash] Rack env
|
18
18
|
def call(env)
|
19
|
-
if env["REQUEST_METHOD"] == "GET" && env["PATH_INFO"] == path
|
19
|
+
if env["REQUEST_METHOD"] == "GET" && env["PATH_INFO"].gsub(/\.md\z/, "") == path
|
20
20
|
[
|
21
21
|
200,
|
22
22
|
{ "Content-Type" => "text/plain; charset=utf-8" },
|
data/spec/fixtures/schema.json
CHANGED
@@ -95,47 +95,11 @@
|
|
95
95
|
"$ref": "#/definitions/app/definitions/name"
|
96
96
|
}
|
97
97
|
}
|
98
|
-
},
|
99
|
-
"recipe": {
|
100
|
-
"$schema": "http://json-schema.org/draft-04/hyper-schema",
|
101
|
-
"description": "cooking Recipe",
|
102
|
-
"title": "Recipe",
|
103
|
-
"type": [
|
104
|
-
"object"
|
105
|
-
],
|
106
|
-
"definitions": {
|
107
|
-
"id": {
|
108
|
-
"description": "unique identifier of recipe",
|
109
|
-
"format": "uuid",
|
110
|
-
"readOnly": true,
|
111
|
-
"example": 1,
|
112
|
-
"type": [
|
113
|
-
"string"
|
114
|
-
]
|
115
|
-
}
|
116
|
-
},
|
117
|
-
"links": [
|
118
|
-
{
|
119
|
-
"description": "List recipes",
|
120
|
-
"href": "/recipes",
|
121
|
-
"method": "GET",
|
122
|
-
"rel": "instances",
|
123
|
-
"title": "list"
|
124
|
-
}
|
125
|
-
],
|
126
|
-
"properties": {
|
127
|
-
"id": {
|
128
|
-
"$ref": "#/definitions/recipe/definitions/id"
|
129
|
-
}
|
130
|
-
}
|
131
98
|
}
|
132
99
|
},
|
133
100
|
"properties": {
|
134
101
|
"app": {
|
135
102
|
"$ref": "#/definitions/app"
|
136
|
-
},
|
137
|
-
"recipe": {
|
138
|
-
"$ref": "#/definitions/recipe"
|
139
103
|
}
|
140
104
|
},
|
141
105
|
"type": [
|
data/spec/rack/spec/docs_spec.rb
CHANGED
@@ -89,5 +89,16 @@ describe Rack::JsonSchema::Docs do
|
|
89
89
|
response.body.should == "dummy"
|
90
90
|
end
|
91
91
|
end
|
92
|
+
|
93
|
+
context "with /docs.md" do
|
94
|
+
let(:path) do
|
95
|
+
"/docs.md"
|
96
|
+
end
|
97
|
+
|
98
|
+
it "also accepts GET /docs.md" do
|
99
|
+
should == 200
|
100
|
+
response.body.should_not == "dummy"
|
101
|
+
end
|
102
|
+
end
|
92
103
|
end
|
93
104
|
end
|
data/spec/rack/spec/mock_spec.rb
CHANGED
@@ -103,7 +103,7 @@ describe Rack::JsonSchema::Mock do
|
|
103
103
|
|
104
104
|
context "without example" do
|
105
105
|
before do
|
106
|
-
schema["definitions"]["
|
106
|
+
schema["definitions"]["app"]["definitions"]["id"].delete("example")
|
107
107
|
end
|
108
108
|
|
109
109
|
let(:verb) do
|
@@ -111,14 +111,14 @@ describe Rack::JsonSchema::Mock do
|
|
111
111
|
end
|
112
112
|
|
113
113
|
let(:path) do
|
114
|
-
"/
|
114
|
+
"/apps"
|
115
115
|
end
|
116
116
|
|
117
117
|
it "returns example_not_found error" do
|
118
118
|
should == 500
|
119
119
|
response.body.should be_json_as(
|
120
120
|
id: "example_not_found",
|
121
|
-
message: "No example found for #/definitions/
|
121
|
+
message: "No example found for #/definitions/app/id",
|
122
122
|
)
|
123
123
|
end
|
124
124
|
end
|
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.0.
|
4
|
+
version: 1.0.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-06-
|
11
|
+
date: 2014-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jdoc
|