Skip to content

Commit 6768d2f

Browse files
Merge branch '2.5' into patch/dto-output-class-same-as-original
2 parents f389004 + 5a7c2e4 commit 6768d2f

File tree

22 files changed

+1952
-1566
lines changed

22 files changed

+1952
-1566
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
/swagger.json
1010
/swagger.yaml
1111
/tests/Fixtures/app/var/
12+
/tests/Fixtures/app/public/bundles/
1213
/vendor/

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
* Subresources: Improve queries when there's only one level #3396
2626
* HTTP: Location header is only set on POST with a 201 or between 300 and 400 #3497
2727
* GraphQL: Do not allow empty cursor values on `before` or `after` #3360
28+
* Bump versions of Swagger UI, GraphiQL and GraphQL Playground #3510
2829

2930
## 2.5.4
3031

CONTRIBUTING.md

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,29 @@ publicly**. We will disclose details of the issue and credit you after having re
3030
First of all, you must decide on what branch your changes will be based depending of the nature of the change.
3131
See [the dedicated documentation entry](https://api-platform.com/docs/extra/releases/).
3232

33+
To prepare your patch directly in the `vendor/` of an existing project (convenient to fix a bug):
34+
35+
1. Remove the existing copy of the library: `rm -Rf vendor/api-platform/core`
36+
2. Reinstall the lib while keeping Git metadata: `composer install --prefer-source`
37+
3. You can now work directly in `vendor/api-platform/core`, create a new branch: `git checkout -b my_patch`
38+
4. When your patch is ready, fork the project and add your Git remote: `git remote add <your-name> [email protected]:<your-name>/core.git`
39+
5. You can now push your code and open your Pull Request: `git push <your-name> my_patch`
40+
41+
Alternatively, you can also work with the test application we provide:
42+
43+
cd tests/Fixtures/app
44+
./console assets:install --symlink
45+
symfony serve
46+
47+
# or if you prefer using the PHP built-in web server
48+
php -S localhost:8000 -t public/
49+
3350
### Matching Coding Standards
3451

3552
The API Platform project follows [Symfony coding standards](https://symfony.com/doc/current/contributing/code/standards.html).
3653
But don't worry, you can fix CS issues automatically using the [PHP CS Fixer](http://cs.sensiolabs.org/) tool:
3754

38-
```shell
39-
php-cs-fixer.phar fix
40-
```
55+
php-cs-fixer.phar fix
4156

4257
And then, add the fixed file to your commit before pushing.
4358
Be sure to add only **your modified files**. If any other file is fixed by cs tools, just revert it before committing.
@@ -66,45 +81,33 @@ Both `phpunit` and `behat` are development dependencies and should be available
6681

6782
To launch unit tests:
6883

69-
```shell
70-
vendor/bin/phpunit --stop-on-failure -vvv
71-
```
84+
vendor/bin/phpunit --stop-on-failure -vvv
7285

73-
If you want coverage, you will need the `phpdbg` package and run:
86+
If you want coverage, you will need the `pcov` PHP extension and run:
7487

75-
```shell
76-
phpdbg -qrr vendor/bin/phpunit --coverage-html coverage -vvv --stop-on-failure
77-
```
88+
vendor/bin/phpunit --coverage-html coverage -vvv --stop-on-failure
7889

7990
Sometimes there might be an error with too many open files when generating coverage. To fix this, you can increase the `ulimit`, for example:
8091

81-
```shell
82-
ulimit -n 4000
83-
```
92+
ulimit -n 4000
8493

8594
Coverage will be available in `coverage/index.html`.
8695

8796
#### Behat
8897

8998
The command to launch Behat tests is:
9099

91-
```shell
92-
./vendor/bin/behat --suite=default --stop-on-failure -vvv
93-
```
100+
./vendor/bin/behat --suite=default --stop-on-failure -vvv
94101

95102
If you want to launch Behat tests for MongoDB, the command is:
96103

97-
```shell
98-
APP_ENV=mongodb ./vendor/bin/behat --suite=mongodb --stop-on-failure -vvv
99-
```
104+
APP_ENV=mongodb ./vendor/bin/behat --suite=mongodb --stop-on-failure -vvv
100105

101106
## Squash your Commits
102107

103108
If you have 3 commits, start with:
104109

105-
```shell
106-
git rebase -i HEAD~3
107-
```
110+
git rebase -i HEAD~3
108111

109112
An editor will be opened with your 3 commits, all prefixed by `pick`.
110113

@@ -116,15 +119,11 @@ After that, all your commits will be squashed into the first one and the commit
116119

117120
If you would like to rename your commit message, type:
118121

119-
```shell
120-
git commit --amend
121-
```
122+
git commit --amend
122123

123124
Now force push to update your PR:
124125

125-
```shell
126-
git push --force-with-lease
127-
```
126+
git push --force-with-lease
128127

129128
# License and Copyright Attribution
130129

@@ -134,3 +133,13 @@ and to transfer the copyright on the submitted code to Kévin Dunglas.
134133
Be sure to you have the right to do that (if you are a professional, ask your company)!
135134

136135
If you include code from another project, please mention it in the Pull Request description and credit the original author.
136+
137+
# Releases
138+
139+
This section is dedicated to maintainers.
140+
141+
1. Update the JavaScript dependencies by running `./update-js.sh` (always check if it works in a browser)
142+
2. Update the `CHANGELOG.md` file (be sure to include Pull Request numbers when appropriate)
143+
3. Create a signed tag: `git tag -s vX.Y.Z -m "Version X.Y.Z"`
144+
4. Create a release using GitHub's UI and copy the changelog
145+
5. Create a new release of `api-platform/api-platform`

features/main/uuid.feature

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,17 @@ Feature: Using uuid identifier on resource
130130
Then the response status code should be 404
131131
And the response should be in JSON
132132
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
133+
134+
@!mongodb
135+
@createSchema
136+
Scenario: Create a resource identified by Ramsey\Uuid\Uuid
137+
When I add "Content-Type" header equal to "application/ld+json"
138+
And I send a "POST" request to "/ramsey_uuid_dummies" with body:
139+
"""
140+
{
141+
"id": "41b29566-144b-11e6-a148-3e1d05defe78"
142+
}
143+
"""
144+
Then the response status code should be 201
145+
And the response should be in JSON
146+
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the API Platform project.
5+
*
6+
* (c) Kévin Dunglas <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace ApiPlatform\Core\Bridge\RamseyUuid\Serializer;
15+
16+
use Ramsey\Uuid\Uuid;
17+
use Ramsey\Uuid\UuidInterface;
18+
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
19+
20+
final class UuidDenormalizer implements DenormalizerInterface
21+
{
22+
public function denormalize($data, $type, $format = null, array $context = [])
23+
{
24+
return Uuid::fromString($data);
25+
}
26+
27+
public function supportsDenormalization($data, $type, $format = null)
28+
{
29+
return \is_string($data) && is_a($type, UuidInterface::class, true);
30+
}
31+
}

src/Bridge/Symfony/Bundle/Resources/config/ramsey_uuid.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@
88
<service id="api_platform.identifier.uuid_normalizer" class="ApiPlatform\Core\Bridge\RamseyUuid\Identifier\Normalizer\UuidNormalizer" public="false">
99
<tag name="api_platform.identifier.denormalizer" />
1010
</service>
11+
12+
<service id="api_platform.serializer.uuid_denormalizer" class="ApiPlatform\Core\Bridge\RamseyUuid\Serializer\UuidDenormalizer" public="false">
13+
<tag name="serializer.normalizer" />
14+
</service>
1115
</services>
1216
</container>

0 commit comments

Comments
 (0)