Skip to content

Commit 4682bc9

Browse files
open api 3.0.0 support. Fixes #10
1 parent eb9054d commit 4682bc9

File tree

9 files changed

+541
-12
lines changed

9 files changed

+541
-12
lines changed

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@
66

77
<p align="center">
88
The Hassle-Free automatic API documentation generation for Laravel. <br>
9-
A Swagger alernative.
9+
A Swagger alernative. <br>
10+
Supports Open API 3.0.0
1011
</p>
1112

1213
**Fast:** Install on any Laravel Project
1314

1415
**Hassle Free:** Auto Generate API Documentation for request rules and parameters
1516

16-
**Analyze:** In build SQL query time analyzer, response time and headers output.
17+
**Analyze:** In built SQL query time analyzer, response time and headers output.
18+
19+
**Supports:** Postmane and OpenAPI 3.0.0 exports.
1720

1821
## Features
1922

@@ -23,6 +26,7 @@
2326
- Support for SQL query, response time and memory consumption by request on Laravel
2427
- Intelligent auto request builder using ``faker.js``
2528
- Display extra documentation using markdown
29+
- Export laravel API, routes, rules and documentation to Postman and OpenAPI 3.0.0
2630
# Read on Medium
2731

2832
Automatically generate api documentation for Laravel without writing annotations.
@@ -31,9 +35,9 @@ Read more: https://medium.com/web-developer/laravel-automatically-generate-api-d
3135

3236
## Requirements
3337

34-
| Lang | Version |
38+
| Lang | Versions |
3539
| :------ | :---------------- |
36-
| PHP | 7.4 or 8.0 |
40+
| PHP | 7.4 or 8.0 or 8.1 |
3741
| Laravel | 6.* or 8.* or 9.* |
3842

3943
# Installation
@@ -53,16 +57,22 @@ php artisan vendor:publish --tag=request-docs-config
5357

5458
# Usage
5559

60+
## Dashboard
61+
5662
View in the browser on ``/request-docs/``
5763

58-
or generate a static HTML
64+
Generate a static HTML and open api specification
5965

6066
```php
6167
php artisan lrd:generate
6268
```
6369

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

72+
## Just want Open API
73+
74+
View in the browser on ``/request-docs/?openapi=true``
75+
6676
# Design pattern
6777

6878
In order for this plugin to work, you need to follow the design pattern by injecting the request class inside the controller.
@@ -140,4 +150,5 @@ Fixing lints
140150
- v1.18 Fix where prism had fixed height. Allow text area resize.
141151
- v1.18 Updated UI and pushed unit tests
142152
- v1.19 Exception -> Throwable for type error
153+
- v1.20 Feature support open api 3.0.0 #10
143154

config/request-docs.php

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,100 @@
3232
"#^telescope#",
3333
"#^docs#",
3434
"#^request-docs#",
35+
],
36+
37+
"open_api" => [
38+
// default version that this library provides
39+
"version" => "3.0.0",
40+
// changeable
41+
"document_version" => "1.0.0",
42+
// license that you want to display
43+
"license" => "Apache 2.0",
44+
"license_url" => "https://www.apache.org/licenses/LICENSE-2.0.html",
45+
"server_url" => env('APP_URL', 'http://localhost'),
46+
47+
// for now putting default responses for all. This can be changed later based on specific needs
48+
"responses" => [
49+
'200' => [
50+
'description' => 'Successful operation',
51+
'content' => [
52+
'application/json' => [
53+
'schema' => [
54+
'type' => 'object',
55+
],
56+
],
57+
],
58+
],
59+
'400' => [
60+
'description' => 'Bad Request',
61+
'content' => [
62+
'application/json' => [
63+
'schema' => [
64+
'type' => 'object',
65+
],
66+
],
67+
],
68+
],
69+
'401' => [
70+
'description' => 'Unauthorized',
71+
'content' => [
72+
'application/json' => [
73+
'schema' => [
74+
'type' => 'object',
75+
],
76+
],
77+
],
78+
],
79+
'403' => [
80+
'description' => 'Forbidden',
81+
'content' => [
82+
'application/json' => [
83+
'schema' => [
84+
'type' => 'object',
85+
],
86+
],
87+
],
88+
],
89+
'404' => [
90+
'description' => 'Not Found',
91+
'content' => [
92+
'application/json' => [
93+
'schema' => [
94+
'type' => 'object',
95+
],
96+
],
97+
],
98+
],
99+
'422' => [
100+
'description' => 'Unprocessable Entity',
101+
'content' => [
102+
'application/json' => [
103+
'schema' => [
104+
'type' => 'object',
105+
],
106+
],
107+
],
108+
],
109+
'500' => [
110+
'description' => 'Internal Server Error',
111+
'content' => [
112+
'application/json' => [
113+
'schema' => [
114+
'type' => 'object',
115+
],
116+
],
117+
],
118+
],
119+
'default' => [
120+
'description' => 'Unexpected error',
121+
'content' => [
122+
'application/json' => [
123+
'schema' => [
124+
'type' => 'object',
125+
],
126+
],
127+
],
128+
],
129+
],
35130
]
36131
];

0 commit comments

Comments
 (0)