Skip to content

Commit

Permalink
Merge pull request #34 from arifszn/33-redoc
Browse files Browse the repository at this point in the history
Add Redoc to display OpenAPI spec in website
  • Loading branch information
arifszn authored Sep 1, 2022
2 parents 217687a + 4f7d995 commit d0a42d4
Show file tree
Hide file tree
Showing 9 changed files with 1,774 additions and 56 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@

- [Dockerized](https://arifszn.github.io/pandora/docs/installation#with-docker-sail)
- [OpenAPI Specification](https://arifszn.github.io/pandora/docs/features/openapi-specification)
- [Swagger UI](https://arifszn.github.io/pandora/docs/api-documentation/swagger-ui)
- [Redoc](https://arifszn.github.io/pandora/docs/api-documentation/redoc)
- [Service Repository Pattern](https://arifszn.github.io/pandora/docs/features/service-repository-pattern)
- [API Resource](https://arifszn.github.io/pandora/docs/features/api-resource)
- [Code Style & Lint](https://arifszn.github.io/pandora/docs/features/code-style-and-lint)
Expand Down
6 changes: 5 additions & 1 deletion app/Http/Controllers/PandoraController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
namespace App\Http\Controllers;

use Illuminate\Foundation\Application;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Response;

class PandoraController extends Controller
{
public function index()
/**
* @return JsonResponse
*/
public function index(): JsonResponse
{
$response['status'] = 'ok';

Expand Down
2 changes: 2 additions & 0 deletions website/docs/1-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ hide_title: true

- [Dockerized](/docs/installation#with-docker-sail)
- [OpenAPI Specification](/docs/features/openapi-specification)
- [Swagger UI](/api-documentation/swagger-ui)
- [Redoc](/api-documentation/redoc)
- [Service Repository Pattern](/docs/features/service-repository-pattern)
- [API Resource](/docs/features/api-resource)
- [Code Style & Lint](/docs/features/code-style-and-lint)
Expand Down
11 changes: 3 additions & 8 deletions website/docs/3-api-documentation/1-swagger-ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ hide_title: true
hide_table_of_contents: true
---

import SwaggerUI from "swagger-ui-react"
import "swagger-ui-react/swagger-ui.css"
import SwaggerUI from "swagger-ui-react";
import "swagger-ui-react/swagger-ui.css";

<SwaggerUI
url="https://raw.githubusercontent.com/arifszn/pandora/main/public/openapi.yaml"
persistAuthorization={true}
displayOperationId={true}
filter={true}
/>
<SwaggerUI url="https://raw.githubusercontent.com/arifszn/pandora/main/public/openapi.yaml" persistAuthorization={true} displayOperationId={true} filter={true} />
9 changes: 9 additions & 0 deletions website/docs/3-api-documentation/2-redoc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Redoc
hide_title: true
hide_table_of_contents: true
---

import ApiDocMdx from '@theme/ApiDocMdx';

<ApiDocMdx id="redoc-nested" />
8 changes: 7 additions & 1 deletion website/docs/3-api-documentation/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"label": "API Documentation",
"collapsible": true,
"collapsed": false
"collapsed": false,
"link": {
"type": "generated-index",
"title": "API Documentation",
"description": "All the available APIs are documented with OpenAPI Specification. The documentation can be viewed in Swagger UI or Redoc.",
"slug": "/api-documentation"
}
}
15 changes: 15 additions & 0 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ const config = {
},
}),
],
[
'redocusaurus',
{
specs: [
{
id: 'redoc-nested',
spec: 'https://raw.githubusercontent.com/arifszn/pandora/main/public/openapi.yaml',
},
],
theme: {
primaryColor: '#6f32be',
primaryColorDark: '#8c65bd',
},
},
],
],

themeConfig:
Expand Down
Loading

0 comments on commit d0a42d4

Please sign in to comment.