Updates on the openapi spec
This commit is contained in:
@@ -7,10 +7,10 @@ use App\Library\Economy\Payment\GatewayInterface;
|
||||
use App\State\GatewayStateProvider;
|
||||
|
||||
/**
|
||||
* Gateways represent payment services used to perform Transactions from Users into Accountings of the platform.\
|
||||
* Gateways represent payment services used to perform the necessary payments for Transactions between Accounts.\
|
||||
* \
|
||||
* For each Gateway there is an internal implementation that handles the creation and validation of Transactions between Accountings.
|
||||
* These implementations make use of external or internal payment services to gather the funds that are inside a Transaction,
|
||||
* For each Gateway there is an internal implementation that handles the creation and validation of Transactions between Accounts.
|
||||
* These implementations make use of external or internal services to gather the funds that are inside a Transaction,
|
||||
* perform corroboration of funds and store the Transactions into the system.
|
||||
*/
|
||||
#[API\GetCollection(provider: GatewayStateProvider::class)]
|
||||
|
||||
@@ -6,8 +6,12 @@ use ApiPlatform\Metadata as API;
|
||||
use App\Repository\AccountRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Accounts are the senders and receivers of Transactions.
|
||||
*/
|
||||
#[ORM\Entity(repositoryClass: AccountRepository::class)]
|
||||
#[API\ApiResource]
|
||||
#[API\Get()]
|
||||
class Account
|
||||
{
|
||||
#[ORM\Id]
|
||||
|
||||
@@ -22,15 +22,19 @@ class OpenApiFactory implements OpenApiFactoryInterface
|
||||
$idResource = $operation->getTags()[0];
|
||||
$idOperation = array_slice($idParts, -1)[0];
|
||||
|
||||
$operationDescription = $operation->getDescription();
|
||||
|
||||
switch ($idOperation) {
|
||||
case 'collection':
|
||||
$operationId = sprintf('List all %ss', $idResource);
|
||||
break;
|
||||
case 'post':
|
||||
$operationId = sprintf('Create one %s', $idResource);
|
||||
$operationDescription = sprintf('Creates a new %s resource.', $idResource);
|
||||
break;
|
||||
case 'get':
|
||||
$operationId = sprintf('Retrieve one %s', $idResource);
|
||||
$operationDescription = sprintf('Retrieves one %s resource.', $idResource);
|
||||
break;
|
||||
case 'put':
|
||||
$operationId = sprintf('Update one %s', $idResource);
|
||||
@@ -46,8 +50,9 @@ class OpenApiFactory implements OpenApiFactoryInterface
|
||||
}
|
||||
|
||||
return $operation
|
||||
->withSummary($operationId)
|
||||
->withOperationId($operationId)
|
||||
->withSummary($operationId);
|
||||
->withDescription($operationDescription);
|
||||
}
|
||||
|
||||
private function updatePathItemOperations(PathItem $pathItem): PathItem
|
||||
@@ -89,6 +94,10 @@ class OpenApiFactory implements OpenApiFactoryInterface
|
||||
{
|
||||
$openApi = $this->decorated->__invoke($context);
|
||||
|
||||
$openApi = $openApi->withServers([
|
||||
new Model\Server(sprintf('%s://%s', $_SERVER['REQUEST_SCHEME'], $_SERVER['HTTP_HOST']))
|
||||
]);
|
||||
|
||||
$openApi = $openApi->withInfo(
|
||||
$openApi
|
||||
->getInfo()
|
||||
@@ -104,8 +113,7 @@ class OpenApiFactory implements OpenApiFactoryInterface
|
||||
|
||||
$tags = [];
|
||||
foreach ($openApi->getComponents()->getSchemas() as $name => $schema) {
|
||||
if (\preg_match('/.*\.json/', $name)) continue;
|
||||
if (empty($schema['description'])) continue;
|
||||
if (\preg_match('/.*\.jsonld/', $name)) continue;
|
||||
|
||||
$tags[] = [
|
||||
'name' => $name,
|
||||
@@ -124,10 +132,6 @@ class OpenApiFactory implements OpenApiFactoryInterface
|
||||
|
||||
$openApi = $openApi->withPaths($paths);
|
||||
|
||||
$openApi = $openApi->withServers([
|
||||
new Model\Server(sprintf('%s://%s', $_SERVER['REQUEST_SCHEME'], $_SERVER['HTTP_HOST']))
|
||||
]);
|
||||
|
||||
return $openApi;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user