Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion app/Http/Controllers/Apis/ReleasesApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
use Illuminate\Support\Facades\Log;
use models\oauth2\IResourceServerContext;
use ModelSerializers\SerializerRegistry;
use OpenApi\Attributes as OA;
use Symfony\Component\HttpFoundation\Response;

/**
* Class ReleasesApiController
Expand All @@ -42,6 +44,29 @@ public function __construct
/**
* @return \Illuminate\Http\JsonResponse|mixed|void
*/
#[OA\Get(
path: '/api/public/v1/releases/current',
operationId: 'getCurrentRelease',
description: 'Retrieve the current OpenStack release',
tags: ['Releases (Public)'],
responses: [
new OA\Response(
response: Response::HTTP_OK,
description: 'Current OpenStack release',
content: new OA\JsonContent(
ref: '#/components/schemas/OpenStackRelease'
)
),
new OA\Response(
response: Response::HTTP_NOT_FOUND,
description: 'Current release not found'
),
new OA\Response(
response: Response::HTTP_INTERNAL_SERVER_ERROR,
description: 'Server Error'
),
]
)]
public function getCurrent(){
try{
$current = $this->repository->getCurrent();
Expand All @@ -57,4 +82,4 @@ public function getCurrent(){
return $this->error500($ex);
}
}
}
}
5 changes: 4 additions & 1 deletion app/Swagger/Models/OpenStackReleaseSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
new OA\Property(property: 'created', type: 'integer', example: 1),
new OA\Property(property: 'last_edited', type: 'integer', example: 1),
new OA\Property(property: 'name', type: 'string'),
new OA\Property(property: 'release_number', type: 'string', example: '2024.2'),
new OA\Property(property: 'release_date', type: 'integer', description: 'Unix timestamp', example: 1729123200),
new OA\Property(property: 'status', type: 'string', example: 'current'),
new OA\Property(property: 'components', type: 'array', items: new OA\Items(
oneOf: [
new OA\Schema(type: 'integer'),
Expand All @@ -23,4 +26,4 @@
]
class OpenStackReleaseSchema
{
}
}
6 changes: 6 additions & 0 deletions app/Swagger/ReleasesSchemas.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

namespace App\Swagger\schemas;

use OpenApi\Attributes as OA;