Skip to content
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

Vups and new features for users #335

Merged
merged 9 commits into from
Feb 13, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

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

steps:
- name: Cancel Previous Runs
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/phptest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

strategy:
matrix:
php: [7.4, 8.0, 8.1, 8.2]
php: [7.4, 8.0, 8.1, 8.2, 8.3]
laravel: [8.*]
include:
- php: 8.0
Expand All @@ -22,6 +22,8 @@ jobs:
laravel: 10.*
- php: 8.2
laravel: 10.*
- php: 8.3
laravel: 10.*

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
node-versions: [18]
node-versions: [20]

steps:
- name: Cancel Previous Runs
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}
],
"require": {
"php": "^7.4|^8.0|^8.1|^8.2",
"php": "^7.4|^8.0|^8.1|^8.2|^8.3",
"illuminate/contracts": "^8.37|^9.0|^10.0",
"kitloong/laravel-app-logger": "^1.0",
"spatie/laravel-package-tools": "^1.4.3",
Expand Down
9 changes: 9 additions & 0 deletions config/request-docs.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php

return [
// changes doc title
'title' => 'LRD - Laravel Request Docs',
'enabled' => true,
// change it to true will make lrd to throw exception if rules in request class need to be changed
// keep it false
Expand Down Expand Up @@ -38,9 +40,16 @@
'rules_methods' => [
'rules'
],

// Can be overridden as // @LRDresponses 200|400|401
'default_responses' => [ "200", "400", "401", "403", "404", "405", "422", "429", "500", "503"],

// changes default headers on first load for Set Global Headers
// Later the local storage is used when edits are made
'default_headers' => [
'Content-Type' => 'application/json',
],

// By default, LRD group your routes by the first /path.
// This is a set of regex to group your routes by prefix.
'group_by' => [
Expand Down
14 changes: 14 additions & 0 deletions src/Controllers/LaravelRequestDocsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,18 @@ public function assets(Request $request)
}
return response()->json(['error' => 'file not found'], 404);
}

/**
* @codeCoverageIgnore
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse
*/
public function config(Request $request)
{
$config = [
'title' => config('request-docs.title'),
'default_headers' => config('request-docs.default_headers'),
];
return response()->json($config);
}
}
4 changes: 4 additions & 0 deletions src/LaravelRequestDocsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public function packageBooted()
->name('request-docs.api')
->middleware(config('request-docs.middlewares'));

Route::get("request-docs/config", [\Rakutentech\LaravelRequestDocs\Controllers\LaravelRequestDocsController::class, 'config'])
->name('request-docs.config')
->middleware(config('request-docs.middlewares'));

Route::get("request-docs/_astro/{slug}", [\Rakutentech\LaravelRequestDocs\Controllers\LaravelRequestDocsController::class, 'assets'])
// where slug is either js or css
->where('slug', '.*js|.*css|.*png|.*jpg|.*jpeg|.*gif|.*svg|.*ico|.*woff|.*woff2|.*ttf|.*eot|.*otf|.*map')
Expand Down
4 changes: 2 additions & 2 deletions ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ npm run dev

## 1) Mode: Readonly

**Open in Browser**
**Open in Browser**

http://localhost:3000/request-docs?api=http://localhost:3000/request-docs/sample.json
http://localhost:3000/request-docs/?api=http://localhost:3000/request-docs/sample.json


## 2) Mode: Developing with Laravel via npm
Expand Down
1 change: 1 addition & 0 deletions ui/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineConfig } from 'astro/config'
import compress from 'astro-compress'
import react from '@astrojs/react'
import process from 'process'

import git from 'git-rev-sync'
const version = git.tag()
Expand Down
Loading
Loading