Skip to content

Commit

Permalink
Merge 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka committed Oct 4, 2024
2 parents 9bcbc1c + 3b948b3 commit fcd9a07
Show file tree
Hide file tree
Showing 35 changed files with 611 additions and 195 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- run: composer validate
- name: Update project dependencies
run: |
composer global require soyuka/pmu
Expand Down
47 changes: 47 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## v4.0.3

### Bug fixes

* [025f63e69](https://github.com/api-platform/core/commit/025f63e69c2ec655a828559ed78c49a365ca043b) fix(laravel): route registration of EntrypointController should be last (#6667)
* [2b4937a3e](https://github.com/api-platform/core/commit/2b4937a3e09fb891b99fd8499b597190a4b740e0) fix(laravel): eloquent accessors (#6668)
* [4312a1f55](https://github.com/api-platform/core/commit/4312a1f55f4f80152be93734cb5cf73c70dee53a) fix(metadata): register parameters on graphql operations
* [6d4e24883](https://github.com/api-platform/core/commit/6d4e24883767f1c58dff5e52f57b0422110fa38f) fix(laravel): hiding/showing relationships (#6679)
* [85306f2f5](https://github.com/api-platform/core/commit/85306f2f5a7d480b1570471689d1d3ca4e9846a3) fix(laravel): swagger ui authentication (#6661)
* [a6e37068e](https://github.com/api-platform/core/commit/a6e37068ea49d1b5a4ee098a62a287d62fba1c35) fix(laravel): use Model::qualifyColumn instead of hardcoding $table.$column (#6658)
* [b0d5a2ade](https://github.com/api-platform/core/commit/b0d5a2adedb583074aa93d4f641bdda419d31ffa) fix(laravel): register global middleware to secure non-rest routes
* [f9d96e546](https://github.com/api-platform/core/commit/f9d96e546a37121244ab98d65c2d91f48b1bb112) fix(metadata): graphql can be disabled but with an existing operation


### Features

* [df701da05](https://github.com/api-platform/core/commit/df701da05620a847f529ebabaee97f8cf5ecb37f) feat(laravel): graphql policies

## v4.0.2

### Bug fixes
Expand Down Expand Up @@ -112,6 +130,21 @@ Notes:

* [0d5f35683](https://github.com/api-platform/core/commit/0d5f356839eb6aa9f536044abe4affa736553e76) feat(laravel): laravel component (#5882)

## v3.4.2

### Bug fixes

* [0ca76fc89](https://github.com/api-platform/core/commit/0ca76fc898d2d1a679a490a5dea85473bf680901) fix(elasticsearch): allow elasticsearch 7 (#6689)
* [15d61c4b7](https://github.com/api-platform/core/commit/15d61c4b75fea2b365e0852a923fed8efbae6ab8) fix(metadata): using parameters in fromClass and toClass uriVariables' options (#6663)
* [2e2044636](https://github.com/api-platform/core/commit/2e204463675939903128037f82916d68f0016719) fix(metadata): parameter provider in a long running http worker (#6683)
* [4c58b33e8](https://github.com/api-platform/core/commit/4c58b33e8c5a90f9377543bd068288dcf84e3236) fix(jsonapi): fixed definition name to allow using the same class names in different namespaces (#6676)
* [4f5f56756](https://github.com/api-platform/core/commit/4f5f5675629fe52ea415a6bd91f3625eedea9c87) fix: remove hydra prefix on errors (#6624)
* [afe7d47d7](https://github.com/api-platform/core/commit/afe7d47d7b7ba6c8591bfb60137a65d1fa1fe38f) fix(metadata): passing class as parameter in XML ApiResource's definition (#6659)
* [b93ee467c](https://github.com/api-platform/core/commit/b93ee467c69253e0cfe60e75b48a5c7aa683474a) fix(metadata): overwriting XML ApiResource definition by YAML ApiResource definition (#6660)

> [!WARNING]
> Hydra prefix on errors is breaking, read `title` not `hydra:title`. The `hydra_prefix` flag doesn't apply to errors as it provided redundant information (both `hydra:title` and `title` were available)
## v3.4.1

### Bug fixes
Expand Down Expand Up @@ -271,6 +304,20 @@ You should now install `api-platform/symfony` instead of `api-platform/core`.
* [74986cb55](https://github.com/api-platform/core/commit/74986cb552182dc645bd1fc967faa0954dd59e0a) feat: inflector as service (#6447)
* [b47edb2a4](https://github.com/api-platform/core/commit/b47edb2a499c34e79c167f963e3a626a3e9d040a) feat(serializer): context IRI in HAL or JsonApi format (#6215)

## v3.3.14

### Bug fixes

* [4c58b33e8](https://github.com/api-platform/core/commit/4c58b33e8c5a90f9377543bd068288dcf84e3236) fix(jsonapi): fixed definition name to allow using the same class names in different namespaces (#6676)

## v3.3.13

### Bug fixes

* [1b9dfccc8](https://github.com/api-platform/core/commit/1b9dfccc8d64be2b04e48490905771a77aefdd96) fix: count TraversablePaginator (#6611)
* [4c58b33e8](https://github.com/api-platform/core/commit/4c58b33e8c5a90f9377543bd068288dcf84e3236) fix(jsonapi): fixed definition name to allow using the same class names in different namespaces (#6676)
* [ef0ee6427](https://github.com/api-platform/core/commit/ef0ee6427f8056bcb2617c228a7cf9ffd9d29ccd) fix(doctrine): use parameter.property for filter value (#6572)

## v3.3.12

### Bug fixes
Expand Down
20 changes: 1 addition & 19 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,24 +115,6 @@
"willdurand/negotiation": "^3.1"
},
"require-dev": {
"api-platform/doctrine-common": "^3.4 || ^4.0",
"api-platform/doctrine-odm": "^3.4 || ^4.0",
"api-platform/doctrine-orm": "^3.4 || ^4.0",
"api-platform/documentation": "^3.4 || ^4.0",
"api-platform/elasticsearch": "^3.4 || ^4.0",
"api-platform/graphql": "^3.4 || ^4.0",
"api-platform/http-cache": "^3.4 || ^4.0",
"api-platform/hydra": "^3.4 || ^4.0",
"api-platform/json-api": "^3.3 || ^4.0",
"api-platform/json-schema": "^3.4 || ^4.0",
"api-platform/jsonld": "^3.4 || ^4.0",
"api-platform/metadata": "^3.4 || ^4.0",
"api-platform/openapi": "^3.4 || ^4.0",
"api-platform/ramsey-uuid": "^3.4 || ^4.0",
"api-platform/json-hal": "^3.4 || ^4.0",
"api-platform/serializer": "^3.4 || ^4.0",
"api-platform/state": "^3.4 || ^4.0",
"api-platform/validator": "^3.4 || ^4.0",
"behat/behat": "^3.11",
"behat/mink": "^1.9",
"doctrine/cache": "^1.11 || ^2.1",
Expand Down Expand Up @@ -170,7 +152,7 @@
"ramsey/uuid": "^4.0",
"ramsey/uuid-doctrine": "^2.0",
"soyuka/contexts": "^3.3.10",
"soyuka/pmu": "^0.0.12",
"soyuka/pmu": "^0.0.15",
"soyuka/stubs-mongodb": "^1.0",
"symfony/asset": "^6.4 || ^7.0",
"symfony/browser-kit": "^6.4 || ^7.0",
Expand Down
12 changes: 6 additions & 6 deletions features/mongodb/filters.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Feature: Filters on collections
And the response should be in JSON
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"
And the JSON node "@context" should be equal to "/contexts/Error"
And the JSON node "@type" should be equal to "hydra:Error"
And the JSON node "hydra:title" should be equal to "An error occurred"
And the JSON node "hydra:description" should be equal to "Cannot use reference 'badFourthLevel' in class 'ThirdLevel' for lookup or graphLookup: dbRef references are not supported."
And the JSON node "@type" should be equal to "Error"
And the JSON node "title" should be equal to "An error occurred"
And the JSON node "description" should be equal to "Cannot use reference 'badFourthLevel' in class 'ThirdLevel' for lookup or graphLookup: dbRef references are not supported."
And the JSON node "trace" should exist

Scenario: Error when getting collection with nested properties if references are not correctly stored (not owning side)
Expand All @@ -23,7 +23,7 @@ Feature: Filters on collections
And the response should be in JSON
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"
And the JSON node "@context" should be equal to "/contexts/Error"
And the JSON node "@type" should be equal to "hydra:Error"
And the JSON node "hydra:title" should be equal to "An error occurred"
And the JSON node "hydra:description" should be equal to "Cannot use reference 'badThirdLevel' in class 'FourthLevel' for lookup or graphLookup: dbRef references are not supported."
And the JSON node "@type" should be equal to "Error"
And the JSON node "title" should be equal to "An error occurred"
And the JSON node "description" should be equal to "Cannot use reference 'badThirdLevel' in class 'FourthLevel' for lookup or graphLookup: dbRef references are not supported."
And the JSON node "trace" should exist
13 changes: 8 additions & 5 deletions generate-changelog.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
#!/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)
lowerbranch=$(git branch --merged HEAD | grep '[[:digit:]]\.[[:digit:]]' | grep -v '*' | sort -rg | head -n 1)
log=$(git log "$1..HEAD" --no-merges --not $lowerbranch --pretty='format:* [%h](https://github.com/api-platform/core/commit/%H) %s')

diff=$(
printf "# Changelog\n\n"
printf "## %s\n\n" "$2"
if [[ 0 != $(echo "$log" | grep fix | grep -v chore | wc -l) ]];
fixes=$(echo "$log" | grep 'fix(\|fix:')
if [[ 0 != $(echo "$fixes" | wc -l) ]];
then
printf "### Bug fixes\n\n"
printf "$log" | grep fix | grep -v chore | sort
printf "$fixes" | sort
printf "\n\n"
fi
if [[ 0 != $(echo "$log" | grep feat | grep -v chore | wc -l) ]];
feat=$(echo "$log" | grep 'feat(\|feat:')
if [[ 0 != $(echo "$feat" | wc -l) ]];
then
printf "### Features\n\n"
printf "$log" | grep feat | grep -v chore | sort
printf "$feat" | sort
fi
)

Expand Down
38 changes: 30 additions & 8 deletions src/GraphQl/Type/FieldsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
use ApiPlatform\GraphQl\Exception\InvalidTypeException;
use ApiPlatform\GraphQl\Resolver\Factory\ResolverFactoryInterface;
use ApiPlatform\GraphQl\Type\Definition\TypeInterface;
use ApiPlatform\Metadata\FilterInterface;
use ApiPlatform\Metadata\GraphQl\Mutation;
use ApiPlatform\Metadata\GraphQl\Operation;
use ApiPlatform\Metadata\GraphQl\Query;
use ApiPlatform\Metadata\GraphQl\Subscription;
use ApiPlatform\Metadata\InflectorInterface;
use ApiPlatform\Metadata\OpenApiParameterFilterInterface;
use ApiPlatform\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
use ApiPlatform\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface;
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
Expand Down Expand Up @@ -296,20 +298,40 @@ public function resolveResourceArgs(array $args, Operation $operation): array
continue;
}

$filter = $this->filterLocator->get($filterId);
$parsedKey = explode('[:property]', $key);
$flattenFields = [];
foreach ($this->filterLocator->get($filterId)->getDescription($operation->getClass()) as $key => $value) {
$values = [];
parse_str($key, $values);
if (isset($values[$parsedKey[0]])) {
$values = $values[$parsedKey[0]];

if ($filter instanceof FilterInterface) {
foreach ($filter->getDescription($operation->getClass()) as $name => $value) {
$values = [];
parse_str($name, $values);
if (isset($values[$parsedKey[0]])) {
$values = $values[$parsedKey[0]];
}

$name = key($values);
$flattenFields[] = ['name' => $name, 'required' => $value['required'] ?? null, 'description' => $value['description'] ?? null, 'leafs' => $values[$name], 'type' => $value['type'] ?? 'string'];
}

$args[$parsedKey[0]] = $this->parameterToObjectType($flattenFields, $parsedKey[0]);
}

if ($filter instanceof OpenApiParameterFilterInterface) {
foreach ($filter->getOpenApiParameters($parameter) as $value) {
$values = [];
parse_str($value->getName(), $values);
if (isset($values[$parsedKey[0]])) {
$values = $values[$parsedKey[0]];
}

$name = key($values);
$flattenFields[] = ['name' => $name, 'required' => $value->getRequired(), 'description' => $value->getDescription(), 'leafs' => $values[$name], 'type' => $value->getSchema()['type'] ?? 'string'];
}

$name = key($values);
$flattenFields[] = ['name' => $name, 'required' => $value['required'] ?? null, 'description' => $value['description'] ?? null, 'leafs' => $values[$name], 'type' => $value['type'] ?? 'string'];
$args[$parsedKey[0]] = $this->parameterToObjectType($flattenFields, $parsedKey[0].$operation->getShortName().$operation->getName());
}

$args[$parsedKey[0]] = $this->parameterToObjectType($flattenFields, $parsedKey[0]);
continue;
}

Expand Down
Loading

0 comments on commit fcd9a07

Please sign in to comment.