Skip to content

Commit d611aa0

Browse files
authored
Merge branch 'master' into 2.2
2 parents d34fba5 + 3d17f85 commit d611aa0

File tree

163 files changed

+2560
-715
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+2560
-715
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ script:
9494
- if [[ $coverage != 1 && $lint != 1 ]]; then
9595
tests/Fixtures/app/console api:swagger:export > swagger.json && swagger-cli validate swagger.json && rm swagger.json;
9696
fi
97+
- if [[ $coverage != 1 && $lint != 1 ]]; then
98+
tests/Fixtures/app/console api:swagger:export --yaml > swagger.yaml && swagger-cli validate --no-schema swagger.yaml && rm swagger.yaml;
99+
fi
97100
- if [[ $lint = 1 ]]; then
98101
php php-cs-fixer.phar fix --dry-run --diff --no-ansi;
99102
fi

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
* Add support for the immutable date and time types introduced in Doctrine
7676
* Fix the Doctrine query generated to retrieve nested subresources
7777
* Fix several bugs in the automatic eager loading support
78-
* Fix a bug occurring when passing nor an IRI nor an array in an embedded relation
78+
* Fix a bug occurring when passing neither an IRI nor an array in an embedded relation
7979
* Allow to request `0` items per page in collections
8080
* Also copy the `Host` from the Symfony Router
8181
* `Paginator::getLastPage()` now always returns a `float`

CONTRIBUTING.md

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ First of all, thank you for contributing, you're awesome!
44

55
To have your code integrated in the API Platform project, there is some rules to follow, but don't panic, it's easy!
66

7-
## Reporting bugs
7+
## Reporting Bugs
88

99
If you happen to find a bug, we kindly request you to report it. However, before submitting it, please:
1010

@@ -27,11 +27,10 @@ publicly**. We will disclose details of the issue and credit you after having re
2727

2828
### Writing a Pull Request
2929

30-
First of all, you must decide on what branch your changes will be based. If the changes your are going to make are
31-
fully backward-compatible, you should base your changes on the latest stable branch (`2.0` at the moment).
32-
Otherwise, you should base your changes on the `master` branch.
30+
First of all, you must decide on what branch your changes will be based depending of the nature of the change.
31+
See [the dedicated documentation entry](https://api-platform.com/docs/extra/releases/).
3332

34-
### Matching coding standards
33+
### Matching Coding Standards
3534

3635
The API Platform project follows [Symfony coding standards](https://symfony.com/doc/current/contributing/code/standards.html).
3736
But don't worry, you can fix CS issues automatically using the [PHP CS Fixer](http://cs.sensiolabs.org/) tool
@@ -52,7 +51,7 @@ When you send a PR, just make sure that:
5251
* You make a PR on the related documentation in the [api-platform/docs](https://github.com/api-platform/docs) repository.
5352
* You make the PR on the same branch you based your changes on. If you see commits
5453
that you did not make in your PR, you're doing it wrong.
55-
* Also don't forget to add a comment when you update a PR with a ping to the maintainer (`@dunglas`, `@sroze` or `@theofidry`), so he/she will get a notification.
54+
* Also don't forget to add a comment when you update a PR with a ping to [the maintainers](https://github.com/orgs/api-platform/people), so he/she will get a notification.
5655
* Squash your commits into one commit. (see the next chapter)
5756

5857
All Pull Requests must include [this header](.github/PULL_REQUEST_TEMPLATE.md).
@@ -63,7 +62,7 @@ On `api-platform/core` there are two kinds of tests: unit (`phpunit`) and integr
6362

6463
Both `phpunit` and `behat` are development dependencies and should be available in the `vendor` directory.
6564

66-
#### Phpunit and coverage generation
65+
#### Phpunit and Coverage Generation
6766

6867
To launch unit tests:
6968

@@ -93,13 +92,7 @@ The command to launch Behat tests is:
9392
./vendor/bin/behat --suite=default --stop-on-failure -vvv
9493
```
9594

96-
You may need to clear the cache manually before running behat tests because of the temporary sql database. To do so, just remove the `test` cache directory:
97-
98-
```
99-
rm -r tests/Fixtures/app/cache/test
100-
```
101-
102-
## Squash your commits
95+
## Squash your Commits
10396

10497
If you have 3 commits. So start with:
10598

@@ -127,7 +120,7 @@ Now force push to update your PR:
127120
git push --force
128121
```
129122

130-
# License and copyright attribution
123+
# License and Copyright Attribution
131124

132125
When you open a Pull Request to the API Platform project, you agree to license your code under the [MIT license](LICENSE)
133126
and to transfer the copyright on the submitted code to Kévin Dunglas.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT license
22

3-
Copyright (c) 2015 Kévin Dunglas
3+
Copyright (c) 2015-present Kévin Dunglas
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

composer.json

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
"behat/symfony2-extension": "^2.1.1",
3434
"behatch/contexts": "^3.0@dev",
3535
"doctrine/annotations": "^1.2",
36-
"doctrine/doctrine-bundle": "^1.6.3",
36+
"doctrine/doctrine-bundle": "^1.8",
3737
"doctrine/orm": "^2.5.2",
38-
"friendsofsymfony/user-bundle": "^2.0",
38+
"friendsofsymfony/user-bundle": "^2.1",
3939
"guzzlehttp/guzzle": "^6.0",
4040
"justinrainbow/json-schema": "^5.0",
4141
"nelmio/api-doc-bundle": "^2.13.3",
@@ -44,41 +44,46 @@
4444
"phpdocumentor/type-resolver": "^0.2.1 || ^0.3 || 0.4",
4545
"phpunit/phpunit": "^6.1",
4646
"psr/log": "^1.0",
47+
"ramsey/uuid": "^3.7",
48+
"ramsey/uuid-doctrine": "^1.4",
4749
"sensio/framework-extra-bundle": "^3.0.11 || ^4.0",
4850
"symfony/asset": "^3.3 || ^4.0",
4951
"symfony/cache": "^3.3 || ^4.0",
50-
"symfony/config": "^3.3 || ^4.0",
51-
"symfony/console": "^3.3 || ^4.0",
52+
"symfony/config": "^3.4 || ^4.0",
53+
"symfony/console": "^3.4 || ^4.0",
5254
"symfony/debug": "^2.8 || ^3.0 || ^4.0",
53-
"symfony/dependency-injection": "^3.3 || ^4.0",
55+
"symfony/dependency-injection": "^3.4 || ^4.0",
5456
"symfony/doctrine-bridge": "^2.8.12 || ^3.0 || ^4.0",
55-
"symfony/event-dispatcher": "^3.3 || ^4.0",
57+
"symfony/event-dispatcher": "^3.4 || ^4.0",
5658
"symfony/expression-language": "^2.8 || ^3.0 || ^4.0",
5759
"symfony/finder": "^3.3 || ^4.0",
5860
"symfony/form": "^3.3 || ^4.0",
5961
"symfony/framework-bundle": "^3.3 || ^4.0",
6062
"symfony/phpunit-bridge": "^3.3 || ^4.0",
6163
"symfony/routing": "^3.3 || ^4.0",
6264
"symfony/security": "^3.0 || ^4.0",
63-
"symfony/security-bundle": "^3.0 || ^4.0",
64-
"symfony/twig-bundle": "^3.1 || ^4.0",
65+
"symfony/security-bundle": "^3.4 || ^4.0",
66+
"symfony/twig-bundle": "^3.4 || ^4.0",
6567
"symfony/validator": "^3.3 || ^4.0",
68+
"symfony/web-profiler-bundle": "^3.3 || ^4.0",
6669
"symfony/yaml": "^3.3 || ^4.0",
6770
"webonyx/graphql-php": "^0.10.2"
6871
},
6972
"conflict": {
70-
"symfony/dependency-injection": "<3.3"
73+
"symfony/dependency-injection": "<3.4"
7174
},
7275
"suggest": {
7376
"friendsofsymfony/user-bundle": "To use the FOSUserBundle bridge.",
7477
"guzzlehttp/guzzle": "To use the HTTP cache invalidation system.",
7578
"phpdocumentor/reflection-docblock": "To support extracting metadata from PHPDoc.",
7679
"psr/cache-implementation": "To use metadata caching.",
80+
"ramsey/uuid": "To support Ramsey's UUID identifiers.",
7781
"symfony/cache": "To have metadata caching when using Symfony integration.",
7882
"symfony/config": "To load XML configuration files.",
7983
"symfony/expression-language": "To use authorization features.",
8084
"symfony/security": "To use authorization features.",
8185
"symfony/twig-bundle": "To use the Swagger UI integration.",
86+
"symfony/web-profiler-bundle": "To use the data collector.",
8287
"webonyx/graphql-php": "To support GraphQL."
8388
},
8489
"autoload": {
@@ -89,7 +94,7 @@
8994
},
9095
"extra": {
9196
"branch-alias": {
92-
"dev-master": "2.2.x-dev"
97+
"dev-master": "2.3.x-dev"
9398
}
9499
},
95100
"config": {

features/authorization/deny.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ Feature: Authorization checking
6565
Then the response status code should be 403
6666
And the response should be in JSON
6767

68-
@dropSchema
6968
Scenario: An user can retrieve an item he owns
7069
When I add "Accept" header equal to "application/ld+json"
7170
And I add "Authorization" header equal to "Basic ZHVuZ2xhczprZXZpbg=="

features/bootstrap/FeatureContext.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\PersonToPet;
3939
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Pet;
4040
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Question;
41+
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\RamseyUuidDummy;
4142
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\RelatedDummy;
4243
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\RelatedToDummyFriend;
4344
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\RelationEmbedder;
@@ -109,17 +110,10 @@ public function removeAcceptHeaderBeforeScenario()
109110
* @BeforeScenario @createSchema
110111
*/
111112
public function createDatabase()
112-
{
113-
$this->schemaTool->createSchema($this->classes);
114-
}
115-
116-
/**
117-
* @AfterScenario @dropSchema
118-
*/
119-
public function dropDatabase()
120113
{
121114
$this->schemaTool->dropSchema($this->classes);
122115
$this->doctrine->getManager()->clear();
116+
$this->schemaTool->createSchema($this->classes);
123117
}
124118

125119
/**
@@ -877,4 +871,16 @@ public function thereAreDummyImmutableDateObjectsWithDummyDate(int $nb)
877871

878872
$this->manager->flush();
879873
}
874+
875+
/**
876+
* @Given there is a ramsey identified resource with uuid :uuid
877+
*/
878+
public function thereIsARamseyIdentifiedResource(string $uuid)
879+
{
880+
$dummy = new RamseyUuidDummy();
881+
$dummy->setId($uuid);
882+
883+
$this->manager->persist($dummy);
884+
$this->manager->flush();
885+
}
880886
}

features/doctrine/boolean_filter.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,6 @@ Feature: Boolean filter on collections
370370
"""
371371
And the JSON node "hydra:totalItems" should be equal to 15
372372

373-
@dropSchema
374373
Scenario: Get collection filtered by non valid properties
375374
When I send a "GET" request to "/dummies?unknown=0"
376375
Then the response status code should be 200

features/doctrine/date_filter.feature

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ Feature: Date filter on collections
264264
}
265265
"""
266266

267-
@dropSchema
268267
Scenario: Get collection filtered by association date
269268
Given there are 30 dummy objects with dummyDate and relatedDummy
270269
When I send a "GET" request to "/dummies?relatedDummy.dummyDate[after]=2015-04-28"
@@ -384,7 +383,6 @@ Feature: Date filter on collections
384383
}
385384
"""
386385

387-
@dropSchema
388386
@createSchema
389387
Scenario: Get collection filtered by association date
390388
Given there are 2 dummy objects with dummyDate and relatedDummy
@@ -672,7 +670,6 @@ Feature: Date filter on collections
672670
}
673671
"""
674672

675-
@dropSchema
676673
@createSchema
677674
Scenario: Get collection filtered by date that is not a datetime
678675
Given there are 30 dummydate objects with dummyDate
@@ -681,7 +678,6 @@ Feature: Date filter on collections
681678
And the JSON node "hydra:totalItems" should be equal to 3
682679
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
683680

684-
@dropSchema
685681
@createSchema
686682
Scenario: Get collection filtered by date that is an immutable date variant
687683
Given there are 30 dummyimmutabledate objects with dummyDate
@@ -690,7 +686,6 @@ Feature: Date filter on collections
690686
And the JSON node "hydra:totalItems" should be equal to 3
691687
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
692688

693-
@dropSchema
694689
@createSchema
695690
Scenario: Get collection filtered by embedded date
696691
Given there are 2 embedded dummy objects with dummyDate and embeddedDummy

features/doctrine/exists_filter.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ Feature: Exists filter on collections
3434
}
3535
"""
3636

37-
@dropSchema
3837
Scenario: Get collection where exists does exist
3938
When I send a "GET" request to "/dummies?dummyBoolean[exists]=1"
4039
Then the response status code should be 200

features/doctrine/multiple_filter.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Feature: Multiple filters on collections
44
I need to retrieve collections filtered by multiple parameters
55

66
@createSchema
7-
@dropSchema
87
Scenario: Get collection filtered by multiple parameters
98
Given there are 30 dummy objects with dummyDate and dummyBoolean true
109
And there are 20 dummy objects with dummyDate and dummyBoolean false

features/doctrine/numeric_filter.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ Feature: Numeric filter on collections
4747
}
4848
"""
4949

50-
@dropSchema
5150
Scenario: Get collection by non-numeric dummyPrice=marty
5251
Given there are 10 dummy objects with dummyPrice
5352
When I send a "GET" request to "/dummies?dummyPrice=marty"

features/doctrine/order_filter.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,6 @@ Feature: Order filter on collections
598598
}
599599
"""
600600

601-
@dropSchema
602601
Scenario: Get collection ordered by a non valid properties and on which order filter has been enabled in whitelist mode
603602
When I send a "GET" request to "/dummies?order[alias]=asc"
604603
Then the response status code should be 200

features/doctrine/range_filter.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,6 @@ Feature: Range filter on collections
344344
}
345345
"""
346346

347-
@dropSchema
348347
Scenario: Filter for entities within an impossible range
349348
When I send a "GET" request to "/dummies?dummyPrice[gt]=19.99"
350349
Then the response status code should be 200

features/doctrine/search_filter.feature

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Feature: Search filter on collections
44
I need to search for collections properties
55

66
@createSchema
7-
@dropSchema
87
Scenario: Test ManyToMany with filter on join table
98
Given there is a RelatedDummy with 4 friends
109
When I add "Accept" header equal to "application/hal+json"
@@ -346,7 +345,6 @@ Feature: Search filter on collections
346345
}
347346
"""
348347

349-
@dropSchema
350348
Scenario: Search for entities within an impossible range
351349
When I send a "GET" request to "/dummies?name=MuYm"
352350
Then the response status code should be 200
@@ -376,7 +374,6 @@ Feature: Search filter on collections
376374
"""
377375

378376
@createSchema
379-
@dropSchema
380377
Scenario: Search related collection by name
381378
Given there are 3 dummy objects having each 3 relatedDummies
382379
When I add "Accept" header equal to "application/hal+json"
@@ -467,7 +464,6 @@ Feature: Search filter on collections
467464
"""
468465

469466

470-
@dropSchema
471467
Scenario: Get collection ordered by a non valid properties
472468
When I send a "GET" request to "/dummies?unknown=0"
473469
Then the response status code should be 200

features/filter/property_filter.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Feature: Set properties to include
1111
And the JSON node "alias" should be equal to "Alias #0"
1212
And the JSON node "relatedDummies" should not exist
1313

14-
@dropSchema
1514
Scenario: Test relation embedding
1615
When I send a "GET" request to "/dummies/1?properties[]=name&properties[]=alias&properties[relatedDummy][]=name"
1716
And the JSON node "name" should be equal to "Dummy #1"

features/graphql/authorization.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ Feature: Authorization checking
4040
And the header "Content-Type" should be equal to "application/json"
4141
And the JSON node "errors[0].message" should be equal to "Access Denied."
4242

43-
@dropSchema
4443
Scenario: An anonymous user tries to create a resource he is not allowed to
4544
When I send the following GraphQL request:
4645
"""

0 commit comments

Comments
 (0)