Skip to content

Commit

Permalink
Merge pull request #41078 from nextcloud/update/openapi-extractor
Browse files Browse the repository at this point in the history
Update openapi extractor
  • Loading branch information
julien-nc authored Nov 6, 2023
2 parents 40c8e58 + 5c0e4b7 commit f12a881
Show file tree
Hide file tree
Showing 25 changed files with 192 additions and 190 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
*
* @package OCA\CloudFederationAPI\Controller
*
* @psalm-import-type CloudFederationApiAddShare from ResponseDefinitions
* @psalm-import-type CloudFederationApiValidationError from ResponseDefinitions
* @psalm-import-type CloudFederationApiError from ResponseDefinitions
* @psalm-import-type CloudFederationAPIAddShare from ResponseDefinitions
* @psalm-import-type CloudFederationAPIValidationError from ResponseDefinitions
* @psalm-import-type CloudFederationAPIError from ResponseDefinitions
*/
class RequestHandlerController extends Controller {
public function __construct(
Expand Down Expand Up @@ -90,7 +90,7 @@ public function __construct(
* @param string $shareType 'group' or 'user' share
* @param string $resourceType 'file', 'calendar',...
*
* @return JSONResponse<Http::STATUS_CREATED, CloudFederationApiAddShare, array{}>|JSONResponse<Http::STATUS_BAD_REQUEST, CloudFederationApiValidationError, array{}>|JSONResponse<Http::STATUS_NOT_IMPLEMENTED, CloudFederationApiError, array{}>
* @return JSONResponse<Http::STATUS_CREATED, CloudFederationAPIAddShare, array{}>|JSONResponse<Http::STATUS_BAD_REQUEST, CloudFederationAPIValidationError, array{}>|JSONResponse<Http::STATUS_NOT_IMPLEMENTED, CloudFederationAPIError, array{}>
* 201: The notification was successfully received. The display name of the recipient might be returned in the body
* 400: Bad request due to invalid parameters, e.g. when `shareWith` is not found or required properties are missing
* 501: Share type or the resource type is not supported
Expand Down Expand Up @@ -213,7 +213,7 @@ public function addShare($shareWith, $name, $description, $providerId, $owner, $
* @param string|null $providerId ID of the share
* @param array<string, mixed>|null $notification The actual payload of the notification
*
* @return JSONResponse<Http::STATUS_CREATED, array<string, mixed>, array{}>|JSONResponse<Http::STATUS_BAD_REQUEST, CloudFederationApiValidationError, array{}>|JSONResponse<Http::STATUS_FORBIDDEN|Http::STATUS_NOT_IMPLEMENTED, CloudFederationApiError, array{}>
* @return JSONResponse<Http::STATUS_CREATED, array<string, mixed>, array{}>|JSONResponse<Http::STATUS_BAD_REQUEST, CloudFederationAPIValidationError, array{}>|JSONResponse<Http::STATUS_FORBIDDEN|Http::STATUS_NOT_IMPLEMENTED, CloudFederationAPIError, array{}>
* 201: The notification was successfully received
* 400: Bad request due to invalid parameters, e.g. when `type` is invalid or missing
* 403: Getting resource is not allowed
Expand Down
6 changes: 3 additions & 3 deletions apps/cloud_federation_api/lib/ResponseDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
namespace OCA\CloudFederationAPI;

/**
* @psalm-type CloudFederationApiAddShare = array{
* @psalm-type CloudFederationAPIAddShare = array{
* recipientDisplayName: string,
* }
*
* @psalm-type CloudFederationApiError = array{
* @psalm-type CloudFederationAPIError = array{
* message: string,
* }
*
* @psalm-type CloudFederationApiValidationError = CloudFederationApiError&array{
* @psalm-type CloudFederationAPIValidationError = CloudFederationAPIError&array{
* validationErrors: array{
* name: string,
* message: string|null,
Expand Down
5 changes: 0 additions & 5 deletions apps/files/appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,6 @@
'url' => '/api/v1/views',
'verb' => 'GET'
],
[
'name' => 'Api#getViewConfig',
'url' => '/api/v1/views/{view}',
'verb' => 'GET'
],
[
'name' => 'Api#setConfig',
'url' => '/api/v1/config/{key}',
Expand Down
6 changes: 3 additions & 3 deletions apps/files_external/lib/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
use OCP\IRequest;

/**
* @psalm-import-type FilesExternalMount from ResponseDefinitions
* @psalm-import-type Files_ExternalMount from ResponseDefinitions
*/
class ApiController extends OCSController {

Expand All @@ -64,7 +64,7 @@ public function __construct(
* @param string $mountPoint mount point name, relative to the data dir
* @param StorageConfig $mountConfig mount config to format
*
* @return FilesExternalMount
* @return Files_ExternalMount
*/
private function formatMount(string $mountPoint, StorageConfig $mountConfig): array {
// split path from mount point
Expand Down Expand Up @@ -100,7 +100,7 @@ private function formatMount(string $mountPoint, StorageConfig $mountConfig): ar
*
* Get the mount points visible for this user
*
* @return DataResponse<Http::STATUS_OK, FilesExternalMount[], array{}>
* @return DataResponse<Http::STATUS_OK, Files_ExternalMount[], array{}>
*
* 200: User mounts returned
*/
Expand Down
4 changes: 2 additions & 2 deletions apps/files_external/lib/Lib/StorageConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
/**
* External storage configuration
*
* @psalm-import-type FilesExternalStorageConfig from ResponseDefinitions
* @psalm-import-type Files_ExternalStorageConfig from ResponseDefinitions
*/
class StorageConfig implements \JsonSerializable {
public const MOUNT_TYPE_ADMIN = 1;
Expand Down Expand Up @@ -399,7 +399,7 @@ public function setType($type) {

/**
* Serialize config to JSON
* @return FilesExternalStorageConfig
* @return Files_ExternalStorageConfig
*/
public function jsonSerialize(bool $obfuscate = false): array {
$result = [];
Expand Down
6 changes: 3 additions & 3 deletions apps/files_external/lib/ResponseDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
namespace OCA\Files_External;

/**
* @psalm-type FilesExternalStorageConfig = array{
* @psalm-type Files_ExternalStorageConfig = array{
* applicableGroups?: string[],
* applicableUsers?: string[],
* authMechanism: string,
Expand All @@ -42,7 +42,7 @@
* userProvided: bool,
* }
*
* @psalm-type FilesExternalMount = array{
* @psalm-type Files_ExternalMount = array{
* name: string,
* path: string,
* type: 'dir',
Expand All @@ -51,7 +51,7 @@
* permissions: int,
* id: int,
* class: string,
* config: FilesExternalStorageConfig,
* config: Files_ExternalStorageConfig,
* }
*/
class ResponseDefinitions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
use OCP\Share\IShare;

/**
* @psalm-import-type FilesSharingDeletedShare from ResponseDefinitions
* @psalm-import-type Files_SharingDeletedShare from ResponseDefinitions
*/
class DeletedShareAPIController extends OCSController {

Expand Down Expand Up @@ -99,7 +99,7 @@ public function __construct(string $appName,
/**
* @suppress PhanUndeclaredClassMethod
*
* @return FilesSharingDeletedShare
* @return Files_SharingDeletedShare
*/
private function formatShare(IShare $share): array {
$result = [
Expand Down Expand Up @@ -187,7 +187,7 @@ private function formatShare(IShare $share): array {
*
* Get a list of all deleted shares
*
* @return DataResponse<Http::STATUS_OK, FilesSharingDeletedShare[], array{}>
* @return DataResponse<Http::STATUS_OK, Files_SharingDeletedShare[], array{}>
*
* 200: Deleted shares returned
*/
Expand Down
8 changes: 4 additions & 4 deletions apps/files_sharing/lib/Controller/RemoteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
use Psr\Log\LoggerInterface;

/**
* @psalm-import-type FilesSharingRemoteShare from ResponseDefinitions
* @psalm-import-type Files_SharingRemoteShare from ResponseDefinitions
*/
class RemoteController extends OCSController {
/**
Expand All @@ -61,7 +61,7 @@ public function __construct(
*
* Get list of pending remote shares
*
* @return DataResponse<Http::STATUS_OK, FilesSharingRemoteShare[], array{}>
* @return DataResponse<Http::STATUS_OK, Files_SharingRemoteShare[], array{}>
*
* 200: Pending remote shares returned
*/
Expand Down Expand Up @@ -139,7 +139,7 @@ private static function extendShareInfo($share) {
*
* Get a list of accepted remote shares
*
* @return DataResponse<Http::STATUS_OK, FilesSharingRemoteShare[], array{}>
* @return DataResponse<Http::STATUS_OK, Files_SharingRemoteShare[], array{}>
*
* 200: Accepted remote shares returned
*/
Expand All @@ -156,7 +156,7 @@ public function getShares() {
* Get info of a remote share
*
* @param int $id ID of the share
* @return DataResponse<Http::STATUS_OK, FilesSharingRemoteShare, array{}>
* @return DataResponse<Http::STATUS_OK, Files_SharingRemoteShare, array{}>
* @throws OCSNotFoundException Share not found
*
* 200: Share returned
Expand Down
22 changes: 11 additions & 11 deletions apps/files_sharing/lib/Controller/ShareAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
/**
* @package OCA\Files_Sharing\API
*
* @psalm-import-type FilesSharingShare from ResponseDefinitions
* @psalm-import-type Files_SharingShare from ResponseDefinitions
*/
class ShareAPIController extends OCSController {

Expand Down Expand Up @@ -177,7 +177,7 @@ public function __construct(
*
* @param \OCP\Share\IShare $share
* @param Node|null $recipientNode
* @return FilesSharingShare
* @return Files_SharingShare
* @throws NotFoundException In case the node can't be resolved.
*
* @suppress PhanUndeclaredClassMethod
Expand Down Expand Up @@ -508,7 +508,7 @@ private function getCachedFederatedDisplayName(string $userId, bool $cacheOnly =
*
* @param string $id ID of the share
* @param bool $include_tags Include tags in the share
* @return DataResponse<Http::STATUS_OK, FilesSharingShare, array{}>
* @return DataResponse<Http::STATUS_OK, Files_SharingShare, array{}>
* @throws OCSNotFoundException Share not found
*
* 200: Share returned
Expand Down Expand Up @@ -602,7 +602,7 @@ public function deleteShare(string $id): DataResponse {
* @param string $label Label for the share (only used in link and email)
* @param string|null $attributes Additional attributes for the share
*
* @return DataResponse<Http::STATUS_OK, FilesSharingShare, array{}>
* @return DataResponse<Http::STATUS_OK, Files_SharingShare, array{}>
* @throws OCSBadRequestException Unknown share type
* @throws OCSException
* @throws OCSForbiddenException Creating the share is not allowed
Expand Down Expand Up @@ -879,7 +879,7 @@ public function createShare(
* @param null|Node $node
* @param boolean $includeTags
*
* @return FilesSharingShare[]
* @return Files_SharingShare[]
*/
private function getSharedWithMe($node, bool $includeTags): array {
$userShares = $this->shareManager->getSharedWith($this->currentUser, IShare::TYPE_USER, $node, -1, 0);
Expand Down Expand Up @@ -916,7 +916,7 @@ private function getSharedWithMe($node, bool $includeTags): array {
/**
* @param \OCP\Files\Node $folder
*
* @return FilesSharingShare[]
* @return Files_SharingShare[]
* @throws OCSBadRequestException
* @throws NotFoundException
*/
Expand Down Expand Up @@ -978,7 +978,7 @@ private function getSharesInDir(Node $folder): array {
* @param string $path Get shares for a specific path
* @param string $include_tags Include tags in the share
*
* @return DataResponse<Http::STATUS_OK, FilesSharingShare[], array{}>
* @return DataResponse<Http::STATUS_OK, Files_SharingShare[], array{}>
* @throws OCSNotFoundException The folder was not found or is inaccessible
*
* 200: Shares returned
Expand Down Expand Up @@ -1026,7 +1026,7 @@ public function getShares(
* @param bool $subFiles
* @param bool $includeTags
*
* @return FilesSharingShare[]
* @return Files_SharingShare[]
* @throws NotFoundException
* @throws OCSBadRequestException
*/
Expand Down Expand Up @@ -1111,7 +1111,7 @@ private function getFormattedShares(
*
* @param string $path Path all shares will be relative to
*
* @return DataResponse<Http::STATUS_OK, FilesSharingShare[], array{}>
* @return DataResponse<Http::STATUS_OK, Files_SharingShare[], array{}>
* @throws InvalidPathException
* @throws NotFoundException
* @throws OCSNotFoundException The given path is invalid
Expand Down Expand Up @@ -1213,7 +1213,7 @@ private function hasPermission(int $permissionsSet, int $permissionsToCheck): bo
* @param string|null $label New label
* @param string|null $hideDownload New condition if the download should be hidden
* @param string|null $attributes New additional attributes
* @return DataResponse<Http::STATUS_OK, FilesSharingShare, array{}>
* @return DataResponse<Http::STATUS_OK, Files_SharingShare, array{}>
* @throws OCSBadRequestException Share could not be updated because the requested changes are invalid
* @throws OCSForbiddenException Missing permissions to update the share
* @throws OCSNotFoundException Share not found
Expand Down Expand Up @@ -1409,7 +1409,7 @@ public function updateShare(
*
* Get all shares that are still pending
*
* @return DataResponse<Http::STATUS_OK, FilesSharingShare[], array{}>
* @return DataResponse<Http::STATUS_OK, Files_SharingShare[], array{}>
*
* 200: Pending shares returned
*/
Expand Down
12 changes: 6 additions & 6 deletions apps/files_sharing/lib/Controller/ShareInfoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
use OCP\Share\IManager;

/**
* @psalm-import-type FilesSharingShareInfo from ResponseDefinitions
* @psalm-import-type Files_SharingShareInfo from ResponseDefinitions
*/
class ShareInfoController extends ApiController {

Expand Down Expand Up @@ -71,7 +71,7 @@ public function __construct(string $appName,
* @param string|null $password Password of the share
* @param string|null $dir Subdirectory to get info about
* @param int $depth Maximum depth to get info about
* @return JSONResponse<Http::STATUS_OK, FilesSharingShareInfo, array{}>|JSONResponse<Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, array<empty>, array{}>
* @return JSONResponse<Http::STATUS_OK, Files_SharingShareInfo, array{}>|JSONResponse<Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, array<empty>, array{}>
*
* 200: Share info returned
* 403: Getting share info is not allowed
Expand Down Expand Up @@ -112,7 +112,7 @@ public function info(string $t, ?string $password = null, ?string $dir = null, i
}

/**
* @return FilesSharingShareInfo
* @return Files_SharingShareInfo
*/
private function parseNode(Node $node, int $permissionMask, int $depth): array {
if ($node instanceof File) {
Expand All @@ -123,14 +123,14 @@ private function parseNode(Node $node, int $permissionMask, int $depth): array {
}

/**
* @return FilesSharingShareInfo
* @return Files_SharingShareInfo
*/
private function parseFile(File $file, int $permissionMask): array {
return $this->format($file, $permissionMask);
}

/**
* @return FilesSharingShareInfo
* @return Files_SharingShareInfo
*/
private function parseFolder(Folder $folder, int $permissionMask, int $depth): array {
$data = $this->format($folder, $permissionMask);
Expand All @@ -150,7 +150,7 @@ private function parseFolder(Folder $folder, int $permissionMask, int $depth): a
}

/**
* @return FilesSharingShareInfo
* @return Files_SharingShareInfo
*/
private function format(Node $node, int $permissionMask): array {
$entry = [];
Expand Down
10 changes: 5 additions & 5 deletions apps/files_sharing/lib/Controller/ShareesAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
use function usort;

/**
* @psalm-import-type FilesSharingShareesSearchResult from ResponseDefinitions
* @psalm-import-type FilesSharingShareesRecommendedResult from ResponseDefinitions
* @psalm-import-type Files_SharingShareesSearchResult from ResponseDefinitions
* @psalm-import-type Files_SharingShareesRecommendedResult from ResponseDefinitions
*/
class ShareesAPIController extends OCSController {

Expand All @@ -82,7 +82,7 @@ class ShareesAPIController extends OCSController {
/** @var int */
protected $limit = 10;

/** @var FilesSharingShareesSearchResult */
/** @var Files_SharingShareesSearchResult */
protected $result = [
'exact' => [
'users' => [],
Expand Down Expand Up @@ -145,7 +145,7 @@ public function __construct(
* @param int $perPage Limit amount of search results per page
* @param int|int[]|null $shareType Limit to specific share types
* @param bool $lookup If a global lookup should be performed too
* @return DataResponse<Http::STATUS_OK, FilesSharingShareesSearchResult, array{Link?: string}>
* @return DataResponse<Http::STATUS_OK, Files_SharingShareesSearchResult, array{Link?: string}>
* @throws OCSBadRequestException Invalid search parameters
*
* 200: Sharees search result returned
Expand Down Expand Up @@ -347,7 +347,7 @@ private function getAllSharees(string $user, array $shareTypes): ISearchResult {
*
* @param string $itemType Limit to specific item types
* @param int|int[]|null $shareType Limit to specific share types
* @return DataResponse<Http::STATUS_OK, FilesSharingShareesRecommendedResult, array{}>
* @return DataResponse<Http::STATUS_OK, Files_SharingShareesRecommendedResult, array{}>
*
* 200: Recommended sharees returned
*/
Expand Down
Loading

0 comments on commit f12a881

Please sign in to comment.