File tree Expand file tree Collapse file tree 2 files changed +131
-0
lines changed Expand file tree Collapse file tree 2 files changed +131
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ title : API Reference
3+
4+ language_tabs :
5+ - bash
6+ - javascript
7+
8+ includes :
9+
10+ search : true
11+
12+ toc_footers :
13+ - <a href='http://github.com/mpociot/documentarian'>Documentation Powered by Documentarian</a>
14+ ---
15+ <!-- START_INFO -->
16+ # Info
17+
18+ Welcome to the generated API reference.
19+ [ Get Postman Collection] ( http://localhost/docs/collection.json )
20+
21+ <!-- END_INFO -->
22+
23+ #general
24+ <!-- START_2b6e5a4b188cb183c7e59558cce36cb6 -->
25+ ## Display a listing of the resource.
26+
27+ > Example request:
28+
29+ ``` bash
30+ curl -X GET -G " http://localhost/api/user" \
31+ -H " Accept: application/json"
32+ ```
33+
34+ ``` javascript
35+ var settings = {
36+ " async" : true ,
37+ " crossDomain" : true ,
38+ " url" : " http://localhost/api/user" ,
39+ " method" : " GET" ,
40+ " headers" : {
41+ " accept" : " application/json"
42+ }
43+ }
44+
45+ $ .ajax (settings).done (function (response ) {
46+ console .log (response);
47+ });
48+ ```
49+
50+ > Example response:
51+
52+ ``` json
53+ {
54+ "index_resource" : true
55+ }
56+ ```
57+
58+ ### HTTP Request
59+ ` GET api/user `
60+
61+
62+ <!-- END_2b6e5a4b188cb183c7e59558cce36cb6 -->
63+
64+ <!-- START_7f66c974d24032cb19061d55d801f62b -->
65+ ## Show the form for creating a new resource.
66+
67+ > Example request:
68+
69+ ``` bash
70+ curl -X GET -G " http://localhost/api/user/create" \
71+ -H " Accept: application/json"
72+ ```
73+
74+ ``` javascript
75+ var settings = {
76+ " async" : true ,
77+ " crossDomain" : true ,
78+ " url" : " http://localhost/api/user/create" ,
79+ " method" : " GET" ,
80+ " headers" : {
81+ " accept" : " application/json"
82+ }
83+ }
84+
85+ $ .ajax (settings).done (function (response ) {
86+ console .log (response);
87+ });
88+ ```
89+
90+ > Example response:
91+
92+ ``` json
93+ {
94+ "create_resource" : true
95+ }
96+ ```
97+
98+ ### HTTP Request
99+ ` GET api/user/create `
100+
101+
102+ <!-- END_7f66c974d24032cb19061d55d801f62b -->
103+
104+
Original file line number Diff line number Diff line change @@ -127,6 +127,33 @@ public function testCanParseResourceRoutes()
127127 $ this ->assertFilesHaveSameContent ($ fixtureMarkdown , $ generatedMarkdown );
128128 }
129129
130+ public function testCanParsePartialResourceRoutes ()
131+ {
132+ RouteFacade::resource ('/api/user ' , TestResourceController::class, [
133+ 'only ' => [
134+ 'index ' , 'create '
135+ ]
136+ ]);
137+ $ output = $ this ->artisan ('api:generate ' , [
138+ '--routePrefix ' => 'api/* ' ,
139+ ]);
140+ $ fixtureMarkdown = __DIR__ .'/Fixtures/partial_resource_index.md ' ;
141+ $ generatedMarkdown = __DIR__ .'/../public/docs/source/index.md ' ;
142+ $ this ->assertFilesHaveSameContent ($ fixtureMarkdown , $ generatedMarkdown );
143+
144+ RouteFacade::apiResource ('/api/user ' , TestResourceController::class, [
145+ 'only ' => [
146+ 'index ' , 'create '
147+ ]
148+ ]);
149+ $ output = $ this ->artisan ('api:generate ' , [
150+ '--routePrefix ' => 'api/* ' ,
151+ ]);
152+ $ fixtureMarkdown = __DIR__ .'/Fixtures/partial_resource_index.md ' ;
153+ $ generatedMarkdown = __DIR__ .'/../public/docs/source/index.md ' ;
154+ $ this ->assertFilesHaveSameContent ($ fixtureMarkdown , $ generatedMarkdown );
155+ }
156+
130157 public function testGeneratedMarkdownFileIsCorrect ()
131158 {
132159 RouteFacade::get ('/api/test ' , TestController::class.'@parseMethodDescription ' );
You can’t perform that action at this time.
0 commit comments