Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-8778: Introduce API Platform attributes with schemas #125

Open
wants to merge 22 commits into
base: IBX-8335-full-api-platform
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e0b7992
IBX-8778: Introduce API Platform attributes with schemas
tischsoic Aug 27, 2024
87808d3
Missing attribues, & Introduce x-ibexa-example-file
tischsoic Sep 4, 2024
86a7387
fixes in Location /content/locations/{path}/children
tischsoic Sep 14, 2024
2fc7f29
split controllers - one action per controller: Bookmark,Content,Contn…
tischsoic Sep 16, 2024
36d6d07
split controllers - one action per controller: ObjectState without se…
tischsoic Sep 16, 2024
8011b64
split controllers - one action per controller: User without services
tischsoic Sep 17, 2024
142e347
split controllers - one action per controller: Role without services
tischsoic Sep 17, 2024
2abcfef
Add Head Api Platform operation
tischsoic Sep 17, 2024
5d17e46
Fix Head operation import in BookmarkIsBookmarkedController
tischsoic Sep 17, 2024
1d5a8b8
split controllers - one action per controller: Language without services
tischsoic Sep 17, 2024
0b4d822
split controllers - one action per controller: Location without services
tischsoic Sep 17, 2024
cf5ae43
split controllers - one action per controller: Section without services
tischsoic Sep 17, 2024
6c25182
split controllers - one action per controller: Session without services
tischsoic Sep 17, 2024
ef9879e
add missing Api Platform attributes in Location/ and ObjectState/
tischsoic Sep 17, 2024
ae237bf
split controllers - one action per controller: Trash without services
tischsoic Sep 17, 2024
25d750d
split controllers - one action per controller: URLAlias without services
tischsoic Sep 17, 2024
de9ac2d
split controllers - one action per controller: URLWildcard without se…
tischsoic Sep 17, 2024
0566728
delete old controllers which methods were split
tischsoic Sep 17, 2024
0b7a099
fix-cs after controllers splitting
tischsoic Sep 18, 2024
72073fe
Role policy attributes fixes
tischsoic Sep 19, 2024
773625b
update services config
tischsoic Sep 19, 2024
d5fb87a
Move schemas to common folder to separate them from examples
tischsoic Sep 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
174 changes: 174 additions & 0 deletions src/bundle/ApiPlatform/Head.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Ibexa\Bundle\Rest\ApiPlatform;

use ApiPlatform\Metadata\HttpOperation;
use ApiPlatform\Metadata\Parameters;
use ApiPlatform\OpenApi\Attributes\Webhook;
use ApiPlatform\OpenApi\Model\Operation as OpenApiOperation;
use ApiPlatform\State\OptionsInterface;

#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::IS_REPEATABLE)]
final class Head extends HttpOperation
{
public function __construct(

Check failure on line 20 in src/bundle/ApiPlatform/Head.php

View workflow job for this annotation

GitHub Actions / Unit & integration tests (8.3)

Method Ibexa\Bundle\Rest\ApiPlatform\Head::__construct() has parameter $defaults with no value type specified in iterable type array.

Check failure on line 20 in src/bundle/ApiPlatform/Head.php

View workflow job for this annotation

GitHub Actions / Unit & integration tests (8.3)

Method Ibexa\Bundle\Rest\ApiPlatform\Head::__construct() has parameter $denormalizationContext with no value type specified in iterable type array.

Check failure on line 20 in src/bundle/ApiPlatform/Head.php

View workflow job for this annotation

GitHub Actions / Unit & integration tests (8.3)

Method Ibexa\Bundle\Rest\ApiPlatform\Head::__construct() has parameter $exceptionToStatus with no value type specified in iterable type array.

Check failure on line 20 in src/bundle/ApiPlatform/Head.php

View workflow job for this annotation

GitHub Actions / Unit & integration tests (8.3)

Method Ibexa\Bundle\Rest\ApiPlatform\Head::__construct() has parameter $extraProperties with no value type specified in iterable type array.

Check failure on line 20 in src/bundle/ApiPlatform/Head.php

View workflow job for this annotation

GitHub Actions / Unit & integration tests (8.3)

Method Ibexa\Bundle\Rest\ApiPlatform\Head::__construct() has parameter $hydraContext with no value type specified in iterable type array.

Check failure on line 20 in src/bundle/ApiPlatform/Head.php

View workflow job for this annotation

GitHub Actions / Unit & integration tests (8.3)

Method Ibexa\Bundle\Rest\ApiPlatform\Head::__construct() has parameter $mercure with no value type specified in iterable type array.

Check failure on line 20 in src/bundle/ApiPlatform/Head.php

View workflow job for this annotation

GitHub Actions / Unit & integration tests (8.3)

Method Ibexa\Bundle\Rest\ApiPlatform\Head::__construct() has parameter $normalizationContext with no value type specified in iterable type array.

Check failure on line 20 in src/bundle/ApiPlatform/Head.php

View workflow job for this annotation

GitHub Actions / Unit & integration tests (8.3)

Method Ibexa\Bundle\Rest\ApiPlatform\Head::__construct() has parameter $openapiContext with no value type specified in iterable type array.

Check failure on line 20 in src/bundle/ApiPlatform/Head.php

View workflow job for this annotation

GitHub Actions / Unit & integration tests (8.3)

Method Ibexa\Bundle\Rest\ApiPlatform\Head::__construct() has parameter $options with no value type specified in iterable type array.

Check failure on line 20 in src/bundle/ApiPlatform/Head.php

View workflow job for this annotation

GitHub Actions / Unit & integration tests (8.3)

Method Ibexa\Bundle\Rest\ApiPlatform\Head::__construct() has parameter $requirements with no value type specified in iterable type array.
?string $uriTemplate = null,
?array $types = null,
$formats = null,
$inputFormats = null,
$outputFormats = null,
$uriVariables = null,
?string $routePrefix = null,
?string $routeName = null,
?array $defaults = null,
?array $requirements = null,
?array $options = null,
?bool $stateless = null,
?string $sunset = null,
?string $acceptPatch = null,
$status = null,
?string $host = null,
?array $schemes = null,
?string $condition = null,
?string $controller = null,
?array $headers = null,
?array $cacheHeaders = null,
?array $paginationViaCursor = null,
?array $hydraContext = null,
?array $openapiContext = null,
bool|OpenApiOperation|Webhook|null $openapi = null,
?array $exceptionToStatus = null,
?bool $queryParameterValidationEnabled = null,
?array $links = null,
?string $shortName = null,
?string $class = null,
?bool $paginationEnabled = null,
?string $paginationType = null,
?int $paginationItemsPerPage = null,
?int $paginationMaximumItemsPerPage = null,
?bool $paginationPartial = null,
?bool $paginationClientEnabled = null,
?bool $paginationClientItemsPerPage = null,
?bool $paginationClientPartial = null,
?bool $paginationFetchJoinCollection = null,
?bool $paginationUseOutputWalkers = null,
?array $order = null,
?string $description = null,
?array $normalizationContext = null,
?array $denormalizationContext = null,
?bool $collectDenormalizationErrors = null,
string|\Stringable|null $security = null,
?string $securityMessage = null,
string|\Stringable|null $securityPostDenormalize = null,
?string $securityPostDenormalizeMessage = null,
string|\Stringable|null $securityPostValidation = null,
?string $securityPostValidationMessage = null,
?string $deprecationReason = null,
?array $filters = null,
?array $validationContext = null,
$input = null,
$output = null,
$mercure = null,
$messenger = null,
?bool $elasticsearch = null,
?int $urlGenerationStrategy = null,
?bool $read = null,
?bool $deserialize = null,
?bool $validate = null,
?bool $write = null,
?bool $serialize = null,
?bool $fetchPartial = null,
?bool $forceEager = null,
?int $priority = null,
?string $name = null,
$provider = null,
$processor = null,
?OptionsInterface $stateOptions = null,
array|Parameters|null $parameters = null,
array $extraProperties = [],
) {
parent::__construct(
method: self::METHOD_HEAD,
uriTemplate: $uriTemplate,
types: $types,
formats: $formats,
inputFormats: $inputFormats,
outputFormats: $outputFormats,
uriVariables: $uriVariables,
routePrefix: $routePrefix,
routeName: $routeName,
defaults: $defaults,
requirements: $requirements,
options: $options,
stateless: $stateless,
sunset: $sunset,
acceptPatch: $acceptPatch,
status: $status,
host: $host,
schemes: $schemes,
condition: $condition,
controller: $controller,
headers: $headers,
cacheHeaders: $cacheHeaders,
paginationViaCursor: $paginationViaCursor,
hydraContext: $hydraContext,
openapiContext: $openapiContext,
openapi: $openapi,
exceptionToStatus: $exceptionToStatus,
queryParameterValidationEnabled: $queryParameterValidationEnabled,
links: $links,
shortName: $shortName,
class: $class,
paginationEnabled: $paginationEnabled,
paginationType: $paginationType,
paginationItemsPerPage: $paginationItemsPerPage,
paginationMaximumItemsPerPage: $paginationMaximumItemsPerPage,
paginationPartial: $paginationPartial,
paginationClientEnabled: $paginationClientEnabled,
paginationClientItemsPerPage: $paginationClientItemsPerPage,
paginationClientPartial: $paginationClientPartial,
paginationFetchJoinCollection: $paginationFetchJoinCollection,
paginationUseOutputWalkers: $paginationUseOutputWalkers,
order: $order,
description: $description,
normalizationContext: $normalizationContext,
denormalizationContext: $denormalizationContext,
collectDenormalizationErrors: $collectDenormalizationErrors,
security: $security,
securityMessage: $securityMessage,
securityPostDenormalize: $securityPostDenormalize,
securityPostDenormalizeMessage: $securityPostDenormalizeMessage,
securityPostValidation: $securityPostValidation,
securityPostValidationMessage: $securityPostValidationMessage,
deprecationReason: $deprecationReason,
filters: $filters,
validationContext: $validationContext,
input: $input,
output: $output,
mercure: $mercure,
messenger: $messenger,
elasticsearch: $elasticsearch,
urlGenerationStrategy: $urlGenerationStrategy,
read: $read,
deserialize: $deserialize,
validate: $validate,
write: $write,
serialize: $serialize,
fetchPartial: $fetchPartial,
forceEager: $forceEager,
priority: $priority,
name: $name,
provider: $provider,
processor: $processor,
stateOptions: $stateOptions,
parameters: $parameters,
extraProperties: $extraProperties,
);
}
}
93 changes: 93 additions & 0 deletions src/bundle/Resources/api_platform/examples/GET/Root.json.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"Root": {
"_media-type": "application/vnd.ibexa.api.Root+json",
"content": {
"_href": "/api/ibexa/v2/content/objects",
"_media-type": ""
},
"contentByRemoteId": {
"_href": "/api/ibexa/v2/content/objects{?remoteId}",
"_media-type": ""
},
"contentTypeByIdentifier": {
"_href": "/api/ibexa/v2/content/types{?identifier}",
"_media-type": ""
},
"contentTypeGroupByIdentifier": {
"_href": "/api/ibexa/v2/content/typegroups{?identifier}",
"_media-type": ""
},
"contentTypeGroups": {
"_href": "/api/ibexa/v2/content/typegroups",
"_media-type": "application/vnd.ibexa.api.ContentTypeGroupList+json"
},
"contentTypes": {
"_href": "/api/ibexa/v2/content/types",
"_media-type": "application/vnd.ibexa.api.ContentTypeInfoList+json"
},
"createSession": {
"_href": "/api/ibexa/v2/user/sessions",
"_media-type": "application/vnd.ibexa.api.UserSession+json"
},
"globalUrlAliases": {
"_href": "/api/ibexa/v2/content/urlaliases",
"_media-type": "application/vnd.ibexa.api.UrlAliasRefList+json"
},
"locationByPath": {
"_href": "/api/ibexa/v2/content/locations{?locationPath}",
"_media-type": ""
},
"locationByRemoteId": {
"_href": "/api/ibexa/v2/content/locations{?remoteId}",
"_media-type": ""
},
"objectStateGroups": {
"_href": "/api/ibexa/v2/content/objectstategroups",
"_media-type": "application/vnd.ibexa.api.ObjectStateGroupList+json"
},
"objectStates": {
"_href": "/api/ibexa/v2/content/objectstategroups/{objectStateGroupId}/objectstates",
"_media-type": "application/vnd.ibexa.api.ObjectStateList+json"
},
"roles": {
"_href": "/api/ibexa/v2/user/roles",
"_media-type": "application/vnd.ibexa.api.RoleList+json"
},
"rootLocation": {
"_href": "/api/ibexa/v2/content/locations/1/2",
"_media-type": "application/vnd.ibexa.api.Location+json"
},
"rootMediaFolder": {
"_href": "/api/ibexa/v2/content/locations/1/43",
"_media-type": "application/vnd.ibexa.api.Location+json"
},
"rootUserGroup": {
"_href": "/api/ibexa/v2/user/groups/1/5",
"_media-type": "application/vnd.ibexa.api.UserGroup+json"
},
"sections": {
"_href": "/api/ibexa/v2/content/sections",
"_media-type": "application/vnd.ibexa.api.SectionList+json"
},
"trash": {
"_href": "/api/ibexa/v2/content/trash",
"_media-type": "application/vnd.ibexa.api.Trash+json"
},
"urlWildcards": {
"_href": "/api/ibexa/v2/content/urlwildcards",
"_media-type": "application/vnd.ibexa.api.UrlWildcardList+json"
},
"users": {
"_href": "/api/ibexa/v2/user/users",
"_media-type": "application/vnd.ibexa.api.UserRefList+json"
},
"views": {
"_href": "/api/ibexa/v2/views",
"_media-type": "application/vnd.ibexa.api.RefList+json"
},
"refreshSession": {
"_media-type": "application\/vnd.ibexa.api.UserSession+json",
"_href": "\/api\/ezp\/v2\/user\/sessions\/{sessionId}\/refresh"
}
}
}
25 changes: 25 additions & 0 deletions src/bundle/Resources/api_platform/examples/GET/Root.xml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<Root media-type="application/vnd.ibexa.api.Root+xml">
<content media-type="" href="/api/ibexa/v2/content/objects"/>
<contentByRemoteId media-type="" href="/api/ibexa/v2/content/objects{?remoteId}"/>
<contentTypes media-type="application/vnd.ibexa.api.ContentTypeInfoList+xml" href="/api/ibexa/v2/content/types"/>
<contentTypeByIdentifier media-type="" href="/api/ibexa/v2/content/types{?identifier}"/>
<contentTypeGroups media-type="application/vnd.ibexa.api.ContentTypeGroupList+xml" href="/api/ibexa/v2/content/typegroups"/>
<contentTypeGroupByIdentifier media-type="" href="/api/ibexa/v2/content/typegroups{?identifier}"/>
<users media-type="application/vnd.ibexa.api.UserRefList+xml" href="/api/ibexa/v2/user/users"/>
<roles media-type="application/vnd.ibexa.api.RoleList+xml" href="/api/ibexa/v2/user/roles"/>
<rootLocation media-type="application/vnd.ibexa.api.Location+xml" href="/api/ibexa/v2/content/locations/1/2"/>
<rootUserGroup media-type="application/vnd.ibexa.api.UserGroup+xml" href="/api/ibexa/v2/user/groups/1/5"/>
<rootMediaFolder media-type="application/vnd.ibexa.api.Location+xml" href="/api/ibexa/v2/content/locations/1/43"/>
<locationByRemoteId media-type="" href="/api/ibexa/v2/content/locations{?remoteId}"/>
<locationByPath media-type="" href="/api/ibexa/v2/content/locations{?locationPath}"/>
<trash media-type="application/vnd.ibexa.api.Trash+xml" href="/api/ibexa/v2/content/trash"/>
<sections media-type="application/vnd.ibexa.api.SectionList+xml" href="/api/ibexa/v2/content/sections"/>
<views media-type="application/vnd.ibexa.api.RefList+xml" href="/api/ibexa/v2/views"/>
<objectStateGroups media-type="application/vnd.ibexa.api.ObjectStateGroupList+xml" href="/api/ibexa/v2/content/objectstategroups"/>
<objectStates media-type="application/vnd.ibexa.api.ObjectStateList+xml" href="/api/ibexa/v2/content/objectstategroups/{objectStateGroupId}/objectstates"/>
<globalUrlAliases media-type="application/vnd.ibexa.api.UrlAliasRefList+xml" href="/api/ibexa/v2/content/urlaliases"/>
<urlWildcards media-type="application/vnd.ibexa.api.UrlWildcardList+xml" href="/api/ibexa/v2/content/urlwildcards"/>
<createSession media-type="application/vnd.ibexa.api.UserSession+xml" href="/api/ibexa/v2/user/sessions"/>
<refreshSession media-type="application/vnd.ibexa.api.UserSession+xml" href="/api/ibexa/v2/user/sessions/{sessionId}/refresh"/>
</Root>
Loading
Loading