Skip to content

Commit

Permalink
open api 3.0.0 support. Fixes #10
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincobain2000 committed Apr 2, 2022
1 parent eb9054d commit 4682bc9
Show file tree
Hide file tree
Showing 9 changed files with 541 additions and 12 deletions.
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@

<p align="center">
The Hassle-Free automatic API documentation generation for Laravel. <br>
A Swagger alernative.
A Swagger alernative. <br>
Supports Open API 3.0.0
</p>

**Fast:** Install on any Laravel Project

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

**Analyze:** In build SQL query time analyzer, response time and headers output.
**Analyze:** In built SQL query time analyzer, response time and headers output.

**Supports:** Postmane and OpenAPI 3.0.0 exports.

## Features

Expand All @@ -23,6 +26,7 @@
- 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
- 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 All @@ -31,9 +35,9 @@ Read more: https://medium.com/web-developer/laravel-automatically-generate-api-d

## Requirements

| Lang | Version |
| Lang | Versions |
| :------ | :---------------- |
| PHP | 7.4 or 8.0 |
| PHP | 7.4 or 8.0 or 8.1 |
| Laravel | 6.* or 8.* or 9.* |

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

# Usage

## Dashboard

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

or generate a static HTML
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 Down Expand Up @@ -140,4 +150,5 @@ Fixing lints
- v1.18 Fix where prism had fixed height. Allow text area resize.
- v1.18 Updated UI and pushed unit tests
- v1.19 Exception -> Throwable for type error
- v1.20 Feature support open api 3.0.0 #10

95 changes: 95 additions & 0 deletions config/request-docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,100 @@
"#^telescope#",
"#^docs#",
"#^request-docs#",
],

"open_api" => [
// default version that this library provides
"version" => "3.0.0",
// changeable
"document_version" => "1.0.0",
// license that you want to display
"license" => "Apache 2.0",
"license_url" => "https://www.apache.org/licenses/LICENSE-2.0.html",
"server_url" => env('APP_URL', 'http://localhost'),

// for now putting default responses for all. This can be changed later based on specific needs
"responses" => [
'200' => [
'description' => 'Successful operation',
'content' => [
'application/json' => [
'schema' => [
'type' => 'object',
],
],
],
],
'400' => [
'description' => 'Bad Request',
'content' => [
'application/json' => [
'schema' => [
'type' => 'object',
],
],
],
],
'401' => [
'description' => 'Unauthorized',
'content' => [
'application/json' => [
'schema' => [
'type' => 'object',
],
],
],
],
'403' => [
'description' => 'Forbidden',
'content' => [
'application/json' => [
'schema' => [
'type' => 'object',
],
],
],
],
'404' => [
'description' => 'Not Found',
'content' => [
'application/json' => [
'schema' => [
'type' => 'object',
],
],
],
],
'422' => [
'description' => 'Unprocessable Entity',
'content' => [
'application/json' => [
'schema' => [
'type' => 'object',
],
],
],
],
'500' => [
'description' => 'Internal Server Error',
'content' => [
'application/json' => [
'schema' => [
'type' => 'object',
],
],
],
],
'default' => [
'description' => 'Unexpected error',
'content' => [
'application/json' => [
'schema' => [
'type' => 'object',
],
],
],
],
],
]
];
Loading

0 comments on commit 4682bc9

Please sign in to comment.