Skip to content

Commit 313e6c8

Browse files
chore: Initial setup for OpenAPI 3.1 documentation
Signed-off-by: matiasperrone-exo <matias.perrone@exomindset.co>
1 parent 13cff1e commit 313e6c8

7 files changed

Lines changed: 830 additions & 3 deletions

File tree

.env.example

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,12 @@ OTEL_TRACES_SAMPLER_PARENT=false
149149
# OTEL_INSTRUMENTATION_VIEW=true
150150
# OTEL_INSTRUMENTATION_LIVEWIRE=true
151151
# OTEL_INSTRUMENTATION_CONSOLE=true
152+
153+
# OpenAPI CONFIG (former Swagger)
154+
155+
L5_SWAGGER_CONST_HOST=${APP_URL}
156+
L5_SWAGGER_CONST_AUTH_URL=${IDP_AUTHORIZATION_ENDPOINT}
157+
L5_SWAGGER_CONST_TOKEN_URL=${IDP_TOKEN_ENDPOINT}
158+
# L5_FORMAT_TO_USE_FOR_DOCS=yaml
159+
L5_SWAGGER_GENERATE_ALWAYS=true # Dev setting
160+
L5_SWAGGER_OPEN_API_SPEC_VERSION=3.2.0

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Homestead.yaml
1515
Homestead.json
1616
.env
1717
.env.*
18-
storage/proxies
18+
storage/*
1919
/public/assets/jquery-cookie/
2020
/public/assets/crypto-js/
2121
/public/assets/bootstrap-tagsinput/

app/Swagger/GenericSchemas.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace App\Swagger\schemas;
4+
5+
use OpenApi\Attributes as OA;
6+
7+
8+
#[OA\SecurityScheme(
9+
securityScheme: "bearerAuth",
10+
type: "http",
11+
scheme: "bearer",
12+
bearerFormat: "JWT"
13+
)]
14+
class BearerAuthSchema
15+
{
16+
}
17+
18+
#[OA\Schema(
19+
schema: 'PaginateDataSchemaResponse',
20+
type: 'object',
21+
properties: [
22+
new OA\Property(property: 'total', type: 'integer', example: 6),
23+
new OA\Property(property: 'per_page', type: 'integer', example: 5),
24+
new OA\Property(property: 'current_page', type: 'integer', example: 1),
25+
new OA\Property(property: 'last_page', type: 'integer', example: 2),
26+
],
27+
description: 'Base pagination metadata'
28+
)]
29+
class PaginateDataSchemaResponseSchema
30+
{
31+
}

app/Swagger/OpenApiInfo.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace App\Swagger;
4+
5+
use OpenApi\Attributes as OA;
6+
7+
#[OA\Info(
8+
version: "1.0.0",
9+
title: "OpenStackID API",
10+
description: "OpenStackID IDP API Documentation - OAuth2, OpenID Connect, and User Management",
11+
contact: new OA\Contact(
12+
name: "OpenStack Foundation",
13+
email: "support@openstack.org"
14+
),
15+
license: new OA\License(
16+
name: "MIT",
17+
url: "https://opensource.org/licenses/MIT"
18+
)
19+
)]
20+
#[OA\Server(
21+
url: "/",
22+
description: "IDP API Server"
23+
)]
24+
class OpenApiInfo
25+
{
26+
}

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"ext-pdo": "*",
2525
"beberlei/doctrineextensions": "1.5.0",
2626
"behat/transliterator": "1.5.0",
27+
"darkaonline/l5-swagger": "^9.0",
2728
"ezyang/htmlpurifier": "v4.17.0",
2829
"firebase/php-jwt": "6.11.1",
2930
"get-stream/stream-chat": "^3.10.0",
@@ -59,7 +60,8 @@
5960
"socialiteproviders/okta": "^4.5.0",
6061
"socialiteproviders/zoho": "^4.1",
6162
"sokil/php-isocodes": "^3.0",
62-
"vladimir-yuldashev/laravel-queue-rabbitmq": "v14.2.0"
63+
"vladimir-yuldashev/laravel-queue-rabbitmq": "v14.2.0",
64+
"zircote/swagger-php": "^5.8"
6365
},
6466
"require-dev": {
6567
"fakerphp/faker": "^1.23",

0 commit comments

Comments
 (0)