Skip to content

Commit 2c2445e

Browse files
Chore | Initial setup for OpenAPI 3.1.2 documentation (#103)
* chore: Initial setup for OpenAPI 3.1 documentation Signed-off-by: matiasperrone-exo <matias.perrone@exomindset.co> * chore: Move to OpenAPI v3.1.2 so UI supports it Signed-off-by: matiasperrone-exo <matias.perrone@exomindset.co> * chore: Add Basic schema which will be referenced by all the other Models schemas Signed-off-by: matiasperrone-exo <matias.perrone@exomindset.co> * chore: change name for Base schema Signed-off-by: matiasperrone-exo <matias.perrone@exomindset.co> * chore: Add requested changes Signed-off-by: matiasperrone-exo <matias.perrone@exomindset.co> * chore: remove unneeded schema Signed-off-by: matiasperrone-exo <matias.perrone@exomindset.co> * update .env.example with right values for OpenAPI docs Signed-off-by: matiasperrone-exo <matias.perrone@exomindset.co> * chore: change API name in config Signed-off-by: matiasperrone-exo <matias.perrone@exomindset.co> --------- Signed-off-by: matiasperrone-exo <matias.perrone@exomindset.co>
1 parent 4b5b726 commit 2c2445e

7 files changed

Lines changed: 834 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='/oauth2/auth'
157+
L5_SWAGGER_CONST_TOKEN_URL='/oauth2/token'
158+
# L5_FORMAT_TO_USE_FOR_DOCS=yaml
159+
L5_SWAGGER_GENERATE_ALWAYS=true # Dev setting
160+
L5_SWAGGER_OPEN_API_SPEC_VERSION=3.1.2

.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: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
namespace App\Swagger\schemas;
4+
5+
use OpenApi\Attributes as OA;
6+
7+
8+
#[OA\Schema(
9+
schema: 'PaginateDataSchemaResponse',
10+
type: 'object',
11+
properties: [
12+
new OA\Property(property: 'total', type: 'integer', example: 6),
13+
new OA\Property(property: 'per_page', type: 'integer', example: 5),
14+
new OA\Property(property: 'current_page', type: 'integer', example: 1),
15+
new OA\Property(property: 'last_page', type: 'integer', example: 2),
16+
],
17+
description: 'Base pagination metadata'
18+
)]
19+
class PaginateDataSchemaResponseSchema
20+
{
21+
}
22+
23+
#[OA\Schema(
24+
schema: 'Base',
25+
type: 'object',
26+
properties: [
27+
new OA\Property(property: 'id', type: 'integer', description: 'Unique identifier', example: 1),
28+
new OA\Property(property: 'created_at', type: 'integer', description: 'Creation timestamp (epoch)', example: 1609459200),
29+
new OA\Property(property: 'updated_at', type: 'integer', description: 'Last update timestamp (epoch)', example: 1609459200),
30+
],
31+
description: 'Base serializer fields'
32+
)]
33+
class BaseSchema
34+
{
35+
}

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: "Apache 2.0",
17+
url: "http://www.apache.org/licenses/LICENSE-2.0"
18+
)
19+
)]
20+
#[OA\Server(
21+
url: L5_SWAGGER_CONST_HOST,
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)