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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 442a54e0315dd0d4f4c79214813b73adcd412f79
4
- data.tar.gz: 588919fd85d9b5ab140733ffe112f7bcf1d6a131
3
+ metadata.gz: 6a1a86a4622d0d9f2b35d84e2f0bcf398e483eb6
4
+ data.tar.gz: 93d3efdfddb2b39fb584476b33a12aa0146cc793
5
5
  SHA512:
6
- metadata.gz: 729e57e7b889c9beb7cbf13c32c03cd8702d96b536ed24ccafc745262058c595fb3f2994f7dfd6820af437b77e95600d52eceddfb992bf92d1ff59de3695036e
7
- data.tar.gz: cfbdfff147ecb7acc5d76133f04bbfbb2753536c38cead79a17bd53ebfaeade12799f515fad95f6b7722ebb6f8faaff189454a703aefaf41e879416f539f14b1
6
+ metadata.gz: 1317f593a583c3a5a325eb4c3eadec87c26ea383ac287487f584e20b654fbdeb48430b0f9c3195c8e6f349a224ea04bcf902beb7c6b47b25e2a9cec95eb00cd6
7
+ data.tar.gz: bfe7fe3c48dfa2a3cd31e0468055dab86581b23820277d36b0caa87f911ea59e8001b1df8c7b843fc768e7a76cbbcbb23207f5ce264dfde90d3b7662f3d8176c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.0.7
2
+ * Accepts GET /docs.md
3
+
1
4
  ## 1.0.6
2
5
  * Improve list detection logic
3
6
 
@@ -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" },
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module JsonSchema
3
- VERSION = "1.0.6"
3
+ VERSION = "1.0.7"
4
4
  end
5
5
  end
@@ -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": [
@@ -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
@@ -103,7 +103,7 @@ describe Rack::JsonSchema::Mock do
103
103
 
104
104
  context "without example" do
105
105
  before do
106
- schema["definitions"]["recipe"]["definitions"]["id"].delete("example")
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
- "/recipes"
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/recipe/id",
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.6
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-19 00:00:00.000000000 Z
11
+ date: 2014-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jdoc