-
-
Notifications
You must be signed in to change notification settings - Fork 895
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: update yaml extractor test file coding standard (#5068) * fix(graphql): add clearer error message when TwigBundle is disabled but graphQL clients are enabled (#5064) * fix(metadata): add class key in payload argument resolver (#5067) * fix: add class key in payload argument resolver * add null if everything else goes wrong * fix: upgrade command remove ApiSubresource attribute (#5049) Fixes #5038 * fix(doctrine): use abitrary index instead of value (#5079) * fix: uri template should respect rfc 6570 (#5080) * fix: remove @internal annotation for Operations (#5089) See #5084 * fix(metadata): define a name on a single operation (#5090) fixes #5082 * fix(metadata): deprecate when user decorates in legacy mode (#5091) fixes #5078 * fix(graphql): use right nested operation (#5102) * Revert "fix(graphql): use right nested operation (#5102)" (#5111) This reverts commit 44337dd. * fix(graphql): always allow to query nested resources (#5112) * fix(graphql): always allow to query nested resources * review Co-authored-by: Alan Poulain <[email protected]> * chore: php-cs-fixer update * fix: only alias if exists for opcache preload Fixes api-platform/api-platform#2284 (#5110) Co-authored-by: Liviu Mirea <[email protected]> * chore: php-cs-fixer update (#5118) * chore: php-cs-fixer update * chore: php-cs-fixer update * fix(metadata): upgrade script keep operation name (#5109) origin: #5105 Co-authored-by: WilliamPeralta <[email protected]> * chore: v2.7.3 changelog * chore: v3.0.3 changelog Co-authored-by: helyakin <[email protected]> Co-authored-by: ArnoudThibaut <[email protected]> Co-authored-by: davy-beauzil <[email protected]> Co-authored-by: Baptiste Leduc <[email protected]> Co-authored-by: Xavier Laviron <[email protected]> Co-authored-by: Alan Poulain <[email protected]> Co-authored-by: Liviu Cristian Mirea-Ghiban <[email protected]> Co-authored-by: Liviu Mirea <[email protected]> Co-authored-by: WilliamPeralta <[email protected]>
- Loading branch information
1 parent
ac70771
commit 6abd0fe
Showing
93 changed files
with
1,128 additions
and
462 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
# usage: generate-changelog.sh previous_tag next_tag | ||
# example: generate-changelog.sh v2.7.2 v2.7.3 > CHANGELOG.new.md | ||
log=$(git log "$1..HEAD" --pretty='format:* [%h](https://github.com/api-platform/core/commit/%H) %s' --no-merges) | ||
|
||
diff=$( | ||
printf "# Changelog\n\n" | ||
printf "## %s\n\n" "$2" | ||
if [[ 0 != $(echo "$log" | grep fix | grep -v chore | wc -l) ]]; | ||
then | ||
printf "### Bug fixes\n\n" | ||
printf "$log" | grep fix | grep -v chore | sort | ||
printf "\n\n" | ||
fi | ||
if [[ 0 != $(echo "$log" | grep feat | grep -v chore | wc -l) ]]; | ||
then | ||
printf "### Features\n\n" | ||
printf "$log" | grep feat | grep -v chore | sort | ||
fi | ||
) | ||
|
||
changelog=$(tail -n+2 CHANGELOG.md) | ||
printf "%s\n%s" "$diff" "$changelog" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
src/GraphQl/Metadata/Factory/GraphQlNestedOperationResourceMetadataFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the API Platform project. | ||
* | ||
* (c) Kévin Dunglas <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ApiPlatform\GraphQl\Metadata\Factory; | ||
|
||
use ApiPlatform\Metadata\ApiResource; | ||
use ApiPlatform\Metadata\Resource\Factory\OperationDefaultsTrait; | ||
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface; | ||
use ApiPlatform\Metadata\Resource\ResourceMetadataCollection; | ||
use Psr\Log\LoggerInterface; | ||
use Psr\Log\NullLogger; | ||
use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter; | ||
|
||
final class GraphQlNestedOperationResourceMetadataFactory implements ResourceMetadataCollectionFactoryInterface | ||
{ | ||
use OperationDefaultsTrait; | ||
|
||
public function __construct(array $defaults, private readonly ?ResourceMetadataCollectionFactoryInterface $decorated = null, ?LoggerInterface $logger = null) | ||
{ | ||
$this->defaults = $defaults; | ||
$this->camelCaseToSnakeCaseNameConverter = new CamelCaseToSnakeCaseNameConverter(); | ||
$this->logger = $logger ?? new NullLogger(); | ||
} | ||
|
||
public function create(string $resourceClass): ResourceMetadataCollection | ||
{ | ||
$resourceMetadataCollection = new ResourceMetadataCollection($resourceClass); | ||
|
||
if ($this->decorated) { | ||
$resourceMetadataCollection = $this->decorated->create($resourceClass); | ||
} | ||
|
||
if (0 < \count($resourceMetadataCollection)) { | ||
return $resourceMetadataCollection; | ||
} | ||
|
||
$shortName = (false !== $pos = strrpos($resourceClass, '\\')) ? substr($resourceClass, $pos + 1) : $resourceClass; | ||
|
||
$apiResource = new ApiResource( | ||
class: $resourceClass, | ||
shortName: $shortName | ||
); | ||
|
||
if (class_exists($resourceClass)) { | ||
$refl = new \ReflectionClass($resourceClass); | ||
$attribute = $refl->getAttributes(ApiResource::class)[0] ?? null; | ||
$attributeInstance = $attribute?->newInstance(); | ||
if ($filters = $attributeInstance?->getFilters()) { | ||
$apiResource = $apiResource->withFilters($filters); | ||
} | ||
} | ||
|
||
$resourceMetadataCollection[0] = $this->addDefaultGraphQlOperations($apiResource); | ||
|
||
return $resourceMetadataCollection; | ||
} | ||
} |
Oops, something went wrong.