Skip to content

v2 - UI renewal #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
on: [push]

name: "CI Node"

jobs:
test:
name: Test

runs-on: ubuntu-latest

strategy:
matrix:
node-versions: [16, 18]

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v2

- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-versions }}

- name: NPM Install
working-directory: ./ui
run: npm install

- name: Lint, build/export
working-directory: ./ui
run: |
npm run lint
npm run export



6 changes: 5 additions & 1 deletion .github/workflows/phptest.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on: [push]

name: "CI"
name: "CI PHP"

jobs:
test:
Expand All @@ -13,6 +13,10 @@ jobs:
php-versions: [7.4, 8.0.6, 8.1, 8.2]

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v2

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ node_modules
.php-cs-fixer.cache
.DS_Store
_ide_helper.php
./ui/.astro
.parcel-cache
.vscode
77 changes: 37 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# MODERNIZATION OF UI RENEWAL is in PROGRESS https://github.com/rakutentech/laravel-request-docs/pull/103
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.

<p align="center">
<a href="https://github.com/rakutentech/laravel-request-docs">
<img alt="Laravel Request Docs" src="https://imgur.com/9eDTUaI.png" width="360">
<img alt="Laravel Request Docs" src="https://imgur.com/2NvLKn2.png">
</a>
</p>

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

## Features

- Light and Dark mode
- Automatic rules fetching from injected Request and by regexp
- Automatic routes fetching from Laravel Routes
- Automatic rules fetching from injected Request
- Support for Laravel logs
- Support for SQL query and query time
- Support for HTTP response time and memory consumption
- Support for Authorization Headers
- Support for SQL query, response time and memory consumption by request on Laravel
- Intelligent auto request builder using ``faker.js``
- Display extra documentation using markdown
- Saves history previous requests
- Added filters to sort, group and filter routes by methods, controllers, middlewares, routes (also see Roadmap 2.x)
- Export laravel API, routes, rules and documentation to Postman and OpenAPI 3.0.0

# Read on Medium

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

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

Generate a static HTML and open api specification

```php
php artisan lrd:generate
```

Docs HTML is generated inside ``docs/``.

## Just want Open API

View in the browser on ``/request-docs/?openapi=true``

# Design pattern

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

# Screenshots

**Generated API documentation**
**Light and Dark Modes**

Light mode
![Preview](https://imgur.com/2s1SrKm.png)

![Preview](https://imgur.com/8DvBBhs.png)
Dark mode
![Preview](https://imgur.com/76sk7Lq.png)

**Try API**

![Preview](https://imgur.com/kcKVSzm.png)
Uses localstorage to save history of previous requests and request headers

![Preview](https://imgur.com/q3d7pw2.png)

**SQL query profile**

![Preview](https://imgur.com/y8jT3jj.png)
![Preview](https://imgur.com/8PLLlHv.png)

**Response profile**

![Preview](https://imgur.com/U0Je956.png)
![Preview](https://imgur.com/fd09jw1.png)

**Customize Headers**
**Settings to sort, group and filter**

![Preview](https://imgur.com/5ydtRd8.png)
![Preview](https://imgur.com/qHq1pjr.png)


# Extra
Expand All @@ -114,29 +110,22 @@ Example of using it in controller
```php
/**
* @lrd:start
* #Hello markdown
* ## Documentation for /my route
* Hello markdown
* ## Free text to write documentation in markdown
* @lrd:end
*/
public function index(MyIndexRequest $request): Resource
{
```

# Custom Params

You write extra params with rules with @QAparam comment line
# Params not in rules

```php
/**
* @QAparam search string
*/
public function index(MyIndexRequest $request): Resource
{
```
You write extra params with rules with @LRDparam in comment line as one line

```php
/**
* @QAparam search string nullable max:32
* @LRDparam username string|max:32
* @LRDparam nickaname string|nullable|max:32
*/
public function index(MyIndexRequest $request): Resource
{
Expand All @@ -161,6 +150,12 @@ Fixing lints
./vendor/bin/php-cs-fixer fix config/
```

# Roadmap for v2.x

- [DONE] UI renewal
- [WIP] Introduce groupby controller names, routes, middlewares
- [WIP] Introduce fetch rules from PHP doc annotations

# Changelog

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

37 changes: 9 additions & 28 deletions config/request-docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,16 @@
// change it to true will make lrd to throw exception if rules in request class need to be changed
// keep it false
'debug' => false,
'document_name' => 'LRD',

/*
* Route where request docs will be served from
* Route where request docs will be served from laravel app.
* localhost:8080/request-docs
*/
'url' => 'request-docs',
'middlewares' => [
//Example
// \App\Http\Middleware\NotFoundWhenProduction::class,
// \Rakutentech\LaravelRequestDocs\NotFoundWhenProduction::class,
],

/*
* Default headers shown on the request headers editor
*/
'default_request_headers' => [
'Accept' => 'application/json',
'X-CSRF-TOKEN' => '',
'Authorization' => 'Bearer',
],

/*
* Show development relevant metadata on endpoints
*/
'show_development_metadata' => true,

/**
* Path to to static HTML if using command line.
*/
'docs_path' => base_path('docs/request-docs/'),

/**
* Sorting route by and there is two types default(route methods), route_names.
*/
'sort_by' => 'route_names',

//Use only routes where ->uri start with next string Using Str::startWith( . e.g. - /api/mobile
'only_route_uri_start_with' => '',

Expand All @@ -53,12 +27,19 @@
'#^_tt#',
],

'hide_meta_data' => false,

// https://github.com/rakutentech/laravel-request-docs/pull/92
// When rules are put in other method than rules()
'request_methods' => [
'rules',
'onCreate',
'onUpdate',
],

// No need to touch below
// open api config
// used to generate open api json
'open_api' => [
// default version that this library provides
'version' => '3.0.0',
Expand Down
1,185 changes: 1,185 additions & 0 deletions resources/dist/_astro/App.bac00898.js

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions resources/dist/_astro/client.8c8eb78c.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions resources/dist/_astro/index.11e2112f.css

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions resources/dist/_astro/index.ba55fcf9.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions resources/dist/_astro/worker-json.bba8ee7e.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion resources/dist/app.js

This file was deleted.

21 changes: 21 additions & 0 deletions resources/dist/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading