Skip to content

Commit caf6a13

Browse files
Merge pull request #250 from jekyll/deprecate-documents
Deprecate documents endpoint completely
2 parents 1cd2775 + fd38f39 commit caf6a13

File tree

2 files changed

+8
-31
lines changed

2 files changed

+8
-31
lines changed

lib/jekyll-admin/server/collection.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@ class Server < Sinatra::Base
1010
json collection.to_api(:include_documents => true)
1111
end
1212

13-
get "/:collection_id/documents" do
14-
ensure_collection
15-
msg = "The `documents` endpoint is deprecated and may be removed at any time."
16-
Jekyll::Deprecator.deprecation_message msg
17-
json collection.docs.map(&:to_api)
18-
end
19-
2013
get "/:collection_id/*" do
2114
ensure_document
2215
json document.to_api(:include_content => true)

spec/jekyll-admin/server/collection_spec.rb

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -57,40 +57,24 @@ def app
5757
expect(first_document).to_not have_key("raw_content")
5858
expect(first_document).to_not have_key("content")
5959
end
60-
end
61-
62-
context "document index" do
63-
it "returns collection documents" do
64-
get "/collections/posts/documents"
65-
expect(last_response).to be_ok
66-
expect(first_response["title"]).to eq("Test")
67-
end
6860

6961
it "includes front matter defaults" do
70-
get "/collections/posts/documents"
62+
get "/collections/posts"
7163
expect(last_response).to be_ok
72-
expect(first_response.key?("some_front_matter")).to eq(true)
64+
expect(first_document.key?("some_front_matter")).to eq(true)
7365
end
7466

7567
it "doesn't include the raw front matter" do
76-
get "/collections/posts/documents"
77-
expect(last_response).to be_ok
78-
expect(first_response).to_not have_key("front_matter")
79-
end
80-
81-
it "doesn't include content in the index" do
82-
get "/collections/posts/documents"
68+
get "/collections/posts"
8369
expect(last_response).to be_ok
84-
expect(first_response).to_not have_key("content")
85-
expect(first_response).to_not have_key("raw_content")
86-
expect(first_response).to_not have_key("output")
70+
expect(first_document).to_not have_key("front_matter")
8771
end
8872

89-
it "doesn't include next/previous in the index" do
90-
get "/collections/posts/documents"
73+
it "doesn't include next/previous" do
74+
get "/collections/posts"
9175
expect(last_response).to be_ok
92-
expect(first_response).to_not have_key("next")
93-
expect(first_response).to_not have_key("previous")
76+
expect(first_document).to_not have_key("next")
77+
expect(first_document).to_not have_key("previous")
9478
end
9579
end
9680

0 commit comments

Comments
 (0)