Skip to content

Commit 25cd509

Browse files
Merge pull request #124 from rakutentech/feature/canary
v2 - UI renewal
2 parents 1795a67 + d2eedbf commit 25cd509

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+20020
-975
lines changed

.github/workflows/node.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
on: [push]
2+
3+
name: "CI Node"
4+
5+
jobs:
6+
test:
7+
name: Test
8+
9+
runs-on: ubuntu-latest
10+
11+
strategy:
12+
matrix:
13+
node-versions: [16, 18]
14+
15+
steps:
16+
- name: Cancel Previous Runs
17+
uses: styfle/[email protected]
18+
with:
19+
access_token: ${{ github.token }}
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
23+
- uses: actions/setup-node@v3
24+
with:
25+
node-version: ${{ matrix.node-versions }}
26+
27+
- name: NPM Install
28+
working-directory: ./ui
29+
run: npm install
30+
31+
- name: Lint, build/export
32+
working-directory: ./ui
33+
run: |
34+
npm run lint
35+
npm run export
36+
37+
38+

.github/workflows/phptest.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
on: [push]
22

3-
name: "CI"
3+
name: "CI PHP"
44

55
jobs:
66
test:
@@ -13,6 +13,10 @@ jobs:
1313
php-versions: [7.4, 8.0.6, 8.1, 8.2]
1414

1515
steps:
16+
- name: Cancel Previous Runs
17+
uses: styfle/[email protected]
18+
with:
19+
access_token: ${{ github.token }}
1620
- name: Checkout
1721
uses: actions/checkout@v2
1822

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ node_modules
1313
.php-cs-fixer.cache
1414
.DS_Store
1515
_ide_helper.php
16+
./ui/.astro
17+
.parcel-cache
18+
.vscode

README.md

Lines changed: 37 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
# MODERNIZATION OF UI RENEWAL is in PROGRESS https://github.com/rakutentech/laravel-request-docs/pull/103
2-
We request to have code freeze on new pull requests, and request to please submit issues with regards to the UI that we can cover in the new UI renewal.
3-
41
<p align="center">
52
<a href="https://github.com/rakutentech/laravel-request-docs">
6-
<img alt="Laravel Request Docs" src="https://imgur.com/9eDTUaI.png" width="360">
3+
<img alt="Laravel Request Docs" src="https://imgur.com/2NvLKn2.png">
74
</a>
85
</p>
96

@@ -23,13 +20,18 @@ We request to have code freeze on new pull requests, and request to please submi
2320

2421
## Features
2522

23+
- Light and Dark mode
24+
- Automatic rules fetching from injected Request and by regexp
2625
- Automatic routes fetching from Laravel Routes
27-
- Automatic rules fetching from injected Request
26+
- Support for Laravel logs
27+
- Support for SQL query and query time
28+
- Support for HTTP response time and memory consumption
2829
- Support for Authorization Headers
29-
- Support for SQL query, response time and memory consumption by request on Laravel
30-
- Intelligent auto request builder using ``faker.js``
3130
- Display extra documentation using markdown
31+
- Saves history previous requests
32+
- Added filters to sort, group and filter routes by methods, controllers, middlewares, routes (also see Roadmap 2.x)
3233
- Export laravel API, routes, rules and documentation to Postman and OpenAPI 3.0.0
34+
3335
# Read on Medium
3436

3537
Automatically generate api documentation for Laravel without writing annotations.
@@ -64,18 +66,6 @@ php artisan vendor:publish --tag=request-docs-config
6466

6567
View in the browser on ``/request-docs/``
6668

67-
Generate a static HTML and open api specification
68-
69-
```php
70-
php artisan lrd:generate
71-
```
72-
73-
Docs HTML is generated inside ``docs/``.
74-
75-
## Just want Open API
76-
77-
View in the browser on ``/request-docs/?openapi=true``
78-
7969
# Design pattern
8070

8171
In order for this plugin to work, you need to follow the design pattern by injecting the request class inside the controller.
@@ -85,25 +75,31 @@ For extra documentation you can use markdown inside your controller method as we
8575

8676
# Screenshots
8777

88-
**Generated API documentation**
78+
**Light and Dark Modes**
79+
80+
Light mode
81+
![Preview](https://imgur.com/2s1SrKm.png)
8982

90-
![Preview](https://imgur.com/8DvBBhs.png)
83+
Dark mode
84+
![Preview](https://imgur.com/76sk7Lq.png)
9185

9286
**Try API**
9387

94-
![Preview](https://imgur.com/kcKVSzm.png)
88+
Uses localstorage to save history of previous requests and request headers
89+
90+
![Preview](https://imgur.com/q3d7pw2.png)
9591

9692
**SQL query profile**
9793

98-
![Preview](https://imgur.com/y8jT3jj.png)
94+
![Preview](https://imgur.com/8PLLlHv.png)
9995

10096
**Response profile**
10197

102-
![Preview](https://imgur.com/U0Je956.png)
98+
![Preview](https://imgur.com/fd09jw1.png)
10399

104-
**Customize Headers**
100+
**Settings to sort, group and filter**
105101

106-
![Preview](https://imgur.com/5ydtRd8.png)
102+
![Preview](https://imgur.com/qHq1pjr.png)
107103

108104

109105
# Extra
@@ -114,29 +110,22 @@ Example of using it in controller
114110
```php
115111
/**
116112
* @lrd:start
117-
* #Hello markdown
118-
* ## Documentation for /my route
113+
* Hello markdown
114+
* ## Free text to write documentation in markdown
119115
* @lrd:end
120116
*/
121117
public function index(MyIndexRequest $request): Resource
122118
{
123119
```
124120

125-
# Custom Params
126-
127-
You write extra params with rules with @QAparam comment line
121+
# Params not in rules
128122

129-
```php
130-
/**
131-
* @QAparam search string
132-
*/
133-
public function index(MyIndexRequest $request): Resource
134-
{
135-
```
123+
You write extra params with rules with @LRDparam in comment line as one line
136124

137125
```php
138126
/**
139-
* @QAparam search string nullable max:32
127+
* @LRDparam username string|max:32
128+
* @LRDparam nickaname string|nullable|max:32
140129
*/
141130
public function index(MyIndexRequest $request): Resource
142131
{
@@ -161,6 +150,12 @@ Fixing lints
161150
./vendor/bin/php-cs-fixer fix config/
162151
```
163152

153+
# Roadmap for v2.x
154+
155+
- [DONE] UI renewal
156+
- [WIP] Introduce groupby controller names, routes, middlewares
157+
- [WIP] Introduce fetch rules from PHP doc annotations
158+
164159
# Changelog
165160

166161
- Initial Release
@@ -179,5 +174,7 @@ Fixing lints
179174
- v1.22 Boolean|File|Image support
180175
- v1.23 Bug fix for lrd doc block #76
181176
- v1.27 A few fixes on width and added request_methods
182-
- v1.30 Minor search box filter added
177+
- v2.0 UI Renewal to React static
178+
- @QAParam is now @LRDparam
179+
- No special changes for users, upgrade to v2.x as usual
183180

config/request-docs.php

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,16 @@
44
// change it to true will make lrd to throw exception if rules in request class need to be changed
55
// keep it false
66
'debug' => false,
7-
'document_name' => 'LRD',
87

98
/*
10-
* Route where request docs will be served from
9+
* Route where request docs will be served from laravel app.
1110
* localhost:8080/request-docs
1211
*/
1312
'url' => 'request-docs',
1413
'middlewares' => [
15-
//Example
16-
// \App\Http\Middleware\NotFoundWhenProduction::class,
14+
// \Rakutentech\LaravelRequestDocs\NotFoundWhenProduction::class,
1715
],
1816

19-
/*
20-
* Default headers shown on the request headers editor
21-
*/
22-
'default_request_headers' => [
23-
'Accept' => 'application/json',
24-
'X-CSRF-TOKEN' => '',
25-
'Authorization' => 'Bearer',
26-
],
27-
28-
/*
29-
* Show development relevant metadata on endpoints
30-
*/
31-
'show_development_metadata' => true,
32-
33-
/**
34-
* Path to to static HTML if using command line.
35-
*/
36-
'docs_path' => base_path('docs/request-docs/'),
37-
38-
/**
39-
* Sorting route by and there is two types default(route methods), route_names.
40-
*/
41-
'sort_by' => 'route_names',
42-
4317
//Use only routes where ->uri start with next string Using Str::startWith( . e.g. - /api/mobile
4418
'only_route_uri_start_with' => '',
4519

@@ -53,12 +27,19 @@
5327
'#^_tt#',
5428
],
5529

30+
'hide_meta_data' => false,
31+
32+
// https://github.com/rakutentech/laravel-request-docs/pull/92
33+
// When rules are put in other method than rules()
5634
'request_methods' => [
5735
'rules',
5836
'onCreate',
5937
'onUpdate',
6038
],
6139

40+
// No need to touch below
41+
// open api config
42+
// used to generate open api json
6243
'open_api' => [
6344
// default version that this library provides
6445
'version' => '3.0.0',

resources/dist/_astro/App.bac00898.js

Lines changed: 1185 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/dist/_astro/client.8c8eb78c.js

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/dist/_astro/index.11e2112f.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/dist/_astro/index.ba55fcf9.js

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

0 commit comments

Comments
 (0)