Skip to content

Commit

Permalink
Merge 351172a into f951657
Browse files Browse the repository at this point in the history
  • Loading branch information
sidz committed Feb 16, 2021
2 parents f951657 + 351172a commit 39c8920
Show file tree
Hide file tree
Showing 20 changed files with 124 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,7 @@

* Mercure: Do not use data in options when deleting (#4056)
* Doctrine: Support for foreign identifiers
* SchemaFactory: Allow generating documentation when property and method start from "is" (property `isActive` and method `isActive`)

## 2.6.2

Expand Down
13 changes: 13 additions & 0 deletions features/hal/collection.feature
Expand Up @@ -73,6 +73,7 @@ Feature: HAL Collections support
"description": "Smart dummy.",
"dummy": "SomeDummyTest1",
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": null,
"dummyFloat": null,
"dummyPrice": null,
Expand All @@ -93,6 +94,7 @@ Feature: HAL Collections support
"description": "Not so smart dummy.",
"dummy": "SomeDummyTest2",
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": null,
"dummyFloat": null,
"dummyPrice": null,
Expand All @@ -113,6 +115,7 @@ Feature: HAL Collections support
"description": "Smart dummy.",
"dummy": "SomeDummyTest3",
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": null,
"dummyFloat": null,
"dummyPrice": null,
Expand Down Expand Up @@ -180,6 +183,7 @@ Feature: HAL Collections support
"description": "Smart dummy.",
"dummy": "SomeDummyTest7",
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": null,
"dummyFloat": null,
"dummyPrice": null,
Expand All @@ -200,6 +204,7 @@ Feature: HAL Collections support
"description": "Not so smart dummy.",
"dummy": "SomeDummyTest8",
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": null,
"dummyFloat": null,
"dummyPrice": null,
Expand All @@ -220,6 +225,7 @@ Feature: HAL Collections support
"description": "Smart dummy.",
"dummy": "SomeDummyTest9",
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": null,
"dummyFloat": null,
"dummyPrice": null,
Expand Down Expand Up @@ -278,6 +284,7 @@ Feature: HAL Collections support
"description": "Not so smart dummy.",
"dummy": "SomeDummyTest10",
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": null,
"dummyFloat": null,
"dummyPrice": null,
Expand Down Expand Up @@ -339,6 +346,7 @@ Feature: HAL Collections support
"description": "Not so smart dummy.",
"dummy": "SomeDummyTest4",
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": null,
"dummyFloat": null,
"dummyPrice": null,
Expand All @@ -359,6 +367,7 @@ Feature: HAL Collections support
"description": "Smart dummy.",
"dummy": "SomeDummyTest5",
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": null,
"dummyFloat": null,
"dummyPrice": null,
Expand All @@ -379,6 +388,7 @@ Feature: HAL Collections support
"description": "Not so smart dummy.",
"dummy": "SomeDummyTest6",
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": null,
"dummyFloat": null,
"dummyPrice": null,
Expand Down Expand Up @@ -501,6 +511,7 @@ Feature: HAL Collections support
"description": "Not so smart dummy.",
"dummy": "SomeDummyTest2",
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": null,
"dummyFloat": null,
"dummyPrice": null,
Expand Down Expand Up @@ -550,6 +561,7 @@ Feature: HAL Collections support
"description": "Not so smart dummy.",
"dummy": "SomeDummyTest8",
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": null,
"dummyFloat": null,
"dummyPrice": null,
Expand Down Expand Up @@ -599,6 +611,7 @@ Feature: HAL Collections support
"description": "Not so smart dummy.",
"dummy": "SomeDummyTest8",
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": null,
"dummyFloat": null,
"dummyPrice": null,
Expand Down
2 changes: 2 additions & 0 deletions features/hal/hal.feature
Expand Up @@ -71,6 +71,7 @@ Feature: HAL support
"description": null,
"dummy": null,
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": "2015-03-01T10:00:00+00:00",
"dummyFloat": null,
"dummyPrice": null,
Expand Down Expand Up @@ -114,6 +115,7 @@ Feature: HAL support
"description": null,
"dummy": null,
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": "2015-03-01T10:00:00+00:00",
"dummyFloat": null,
"dummyPrice": null,
Expand Down
1 change: 1 addition & 0 deletions features/json/relation.feature
Expand Up @@ -208,6 +208,7 @@ Feature: JSON relations support
"description": null,
"dummy": null,
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": null,
"dummyFloat": null,
"dummyPrice": null,
Expand Down
1 change: 1 addition & 0 deletions features/jsonapi/related-resouces-inclusion.feature
Expand Up @@ -338,6 +338,7 @@ Feature: JSON API Inclusion of Related Resources
"description": null,
"dummy": null,
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": null,
"dummyFloat": null,
"dummyPrice": null,
Expand Down
9 changes: 5 additions & 4 deletions features/main/content_negotiation.feature
Expand Up @@ -19,7 +19,7 @@ Feature: Content Negotiation support
And the XML should be equal to:
"""
<?xml version="1.0"?>
<response><description/><dummy/><dummyBoolean/><dummyDate/><dummyFloat/><dummyPrice/><relatedDummy/><relatedDummies/><jsonData/><arrayData/><name_converted/><relatedOwnedDummy/><relatedOwningDummy/><id>1</id><name>XML!</name><alias/><foo/></response>
<response><description/><dummy/><dummyBoolean/><isDummyBoolean/><dummyDate/><dummyFloat/><dummyPrice/><relatedDummy/><relatedDummies/><jsonData/><arrayData/><name_converted/><relatedOwnedDummy/><relatedOwningDummy/><id>1</id><name>XML!</name><alias/><foo/></response>
"""

Scenario: Retrieve a collection in XML
Expand All @@ -31,7 +31,7 @@ Feature: Content Negotiation support
And the XML should be equal to:
"""
<?xml version="1.0"?>
<response><item key="0"><description/><dummy/><dummyBoolean/><dummyDate/><dummyFloat/><dummyPrice/><relatedDummy/><relatedDummies/><jsonData/><arrayData/><name_converted/><relatedOwnedDummy/><relatedOwningDummy/><id>1</id><name>XML!</name><alias/><foo/></item></response>
<response><item key="0"><description/><dummy/><dummyBoolean/><isDummyBoolean/><dummyDate/><dummyFloat/><dummyPrice/><relatedDummy/><relatedDummies/><jsonData/><arrayData/><name_converted/><relatedOwnedDummy/><relatedOwningDummy/><id>1</id><name>XML!</name><alias/><foo/></item></response>
"""

Scenario: Retrieve a collection in XML using the .xml URL
Expand All @@ -42,7 +42,7 @@ Feature: Content Negotiation support
And the XML should be equal to:
"""
<?xml version="1.0"?>
<response><item key="0"><description/><dummy/><dummyBoolean/><dummyDate/><dummyFloat/><dummyPrice/><relatedDummy/><relatedDummies/><jsonData/><arrayData/><name_converted/><relatedOwnedDummy/><relatedOwningDummy/><id>1</id><name>XML!</name><alias/><foo/></item></response>
<response><item key="0"><description/><dummy/><dummyBoolean/><isDummyBoolean/><dummyDate/><dummyFloat/><dummyPrice/><relatedDummy/><relatedDummies/><jsonData/><arrayData/><name_converted/><relatedOwnedDummy/><relatedOwningDummy/><id>1</id><name>XML!</name><alias/><foo/></item></response>
"""

Scenario: Retrieve a collection in JSON
Expand All @@ -58,6 +58,7 @@ Feature: Content Negotiation support
"description": null,
"dummy": null,
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": null,
"dummyFloat": null,
"dummyPrice": null,
Expand Down Expand Up @@ -89,7 +90,7 @@ Feature: Content Negotiation support
And the XML should be equal to:
"""
<?xml version="1.0"?>
<response><description/><dummy/><dummyBoolean/><dummyDate/><dummyFloat/><dummyPrice/><relatedDummy/><relatedDummies/><jsonData/><arrayData/><name_converted/><relatedOwnedDummy/><relatedOwningDummy/><id>2</id><name>Sent in JSON</name><alias/><foo/></response>
<response><description/><dummy/><dummyBoolean/><isDummyBoolean/><dummyDate/><dummyFloat/><dummyPrice/><relatedDummy/><relatedDummies/><jsonData/><arrayData/><name_converted/><relatedOwnedDummy/><relatedOwningDummy/><id>2</id><name>Sent in JSON</name><alias/><foo/></response>
"""

Scenario: Requesting the same format in the Accept header and in the URL should work
Expand Down
4 changes: 4 additions & 0 deletions features/main/crud.feature
Expand Up @@ -33,6 +33,7 @@ Feature: Create-Retrieve-Update-Delete
"description": null,
"dummy": null,
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": "2015-03-01T10:00:00+00:00",
"dummyFloat": null,
"dummyPrice": null,
Expand Down Expand Up @@ -69,6 +70,7 @@ Feature: Create-Retrieve-Update-Delete
"description": null,
"dummy": null,
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": "2015-03-01T10:00:00+00:00",
"dummyFloat": null,
"dummyPrice": null,
Expand Down Expand Up @@ -119,6 +121,7 @@ Feature: Create-Retrieve-Update-Delete
"description": null,
"dummy": null,
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": "2015-03-01T10:00:00+00:00",
"dummyFloat": null,
"dummyPrice": null,
Expand Down Expand Up @@ -523,6 +526,7 @@ Feature: Create-Retrieve-Update-Delete
"description": null,
"dummy": null,
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": "2018-12-01T13:12:00+00:00",
"dummyFloat": null,
"dummyPrice": null,
Expand Down
1 change: 1 addition & 0 deletions features/main/relation.feature
Expand Up @@ -155,6 +155,7 @@ Feature: Relations support
"description": null,
"dummy": null,
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": null,
"dummyFloat": null,
"dummyPrice": null,
Expand Down
2 changes: 2 additions & 0 deletions features/main/subresource.feature
Expand Up @@ -383,6 +383,7 @@ Feature: Subresource support
"description": null,
"dummy": null,
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": null,
"dummyFloat": null,
"dummyPrice": null,
Expand Down Expand Up @@ -416,6 +417,7 @@ Feature: Subresource support
"description": null,
"dummy": null,
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": null,
"dummyFloat": null,
"dummyPrice": null,
Expand Down
5 changes: 3 additions & 2 deletions features/security/strong_typing.feature
Expand Up @@ -25,6 +25,7 @@ Feature: Handle properly invalid data submitted to the API
"description": null,
"dummy": null,
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": null,
"dummyFloat": null,
"dummyPrice": null,
Expand All @@ -33,8 +34,8 @@ Feature: Handle properly invalid data submitted to the API
"jsonData": [],
"arrayData": [],
"name_converted": null,
"relatedOwnedDummy": null,
"relatedOwningDummy": null,
"relatedOwnedDummy": null,
"relatedOwningDummy": null,
"id": 1,
"name": "Not existing",
"alias": null,
Expand Down
1 change: 1 addition & 0 deletions features/security/unknown_attributes.feature
Expand Up @@ -25,6 +25,7 @@ Feature: Ignore unknown attributes
"description": null,
"dummy": null,
"dummyBoolean": null,
"isDummyBoolean": null,
"dummyDate": null,
"dummyFloat": null,
"dummyPrice": null,
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml.dist
Expand Up @@ -6,6 +6,7 @@
backupGlobals="false"
bootstrap="tests/Fixtures/app/bootstrap.php"
colors="true"
stopOnFailure="true"
>
<php>
<ini name="error_reporting" value="-1" />
Expand Down
3 changes: 3 additions & 0 deletions src/JsonSchema/SchemaFactory.php
Expand Up @@ -327,6 +327,9 @@ private function getFactoryOptions(array $serializerContext, array $validationGr
{
$options = [];

/* @see https://github.com/symfony/symfony/blob/v5.1.0/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php */
$options['enable_getter_setter_extraction'] = true;

if (isset($serializerContext[AbstractNormalizer::GROUPS])) {
/* @see https://github.com/symfony/symfony/blob/v4.2.6/src/Symfony/Component/PropertyInfo/Extractor/SerializerExtractor.php */
$options['serializer_groups'] = (array) $serializerContext[AbstractNormalizer::GROUPS];
Expand Down
Expand Up @@ -46,6 +46,11 @@ public function testGetDescriptionDefaultFields()
'type' => 'bool',
'required' => false,
],
'isDummyBoolean' => [
'property' => 'isDummyBoolean',
'type' => 'bool',
'required' => false,
],
], $filter->getDescription($this->resourceClass));
}

Expand Down
5 changes: 5 additions & 0 deletions tests/Bridge/Doctrine/Orm/Filter/ExistsFilterTest.php
Expand Up @@ -90,6 +90,11 @@ public function testGetDescriptionDefaultFields()
'type' => 'bool',
'required' => false,
],
'exists[isDummyBoolean]' => [
'property' => 'isDummyBoolean',
'type' => 'bool',
'required' => false,
],
], $filter->getDescription($this->resourceClass));
}

Expand Down
12 changes: 12 additions & 0 deletions tests/Bridge/Doctrine/Orm/Filter/OrderFilterTest.php
Expand Up @@ -180,6 +180,18 @@ public function testGetDescriptionDefaultFields()
],
],
],
'order[isDummyBoolean]' => [
'property' => 'isDummyBoolean',
'type' => 'string',
'required' => false,
'schema' => [
'type' => 'string',
'enum' => [
'asc',
'desc',
],
],
],
], $filter->getDescription($this->resourceClass));
}

Expand Down
25 changes: 25 additions & 0 deletions tests/Bridge/Doctrine/Orm/Filter/RangeFilterTest.php
Expand Up @@ -332,6 +332,31 @@ public function testGetDescriptionDefaultFields()
'type' => 'string',
'required' => false,
],
'isDummyBoolean[between]' => [
'property' => 'isDummyBoolean',
'type' => 'string',
'required' => false,
],
'isDummyBoolean[gt]' => [
'property' => 'isDummyBoolean',
'type' => 'string',
'required' => false,
],
'isDummyBoolean[gte]' => [
'property' => 'isDummyBoolean',
'type' => 'string',
'required' => false,
],
'isDummyBoolean[lt]' => [
'property' => 'isDummyBoolean',
'type' => 'string',
'required' => false,
],
'isDummyBoolean[lte]' => [
'property' => 'isDummyBoolean',
'type' => 'string',
'required' => false,
],
], $filter->getDescription($this->resourceClass));
}

Expand Down
14 changes: 14 additions & 0 deletions tests/Bridge/Doctrine/Orm/Filter/SearchFilterTest.php
Expand Up @@ -214,6 +214,20 @@ public function testGetDescriptionDefaultFields()
'strategy' => 'exact',
'is_collection' => true,
],
'isDummyBoolean' => [
'property' => 'isDummyBoolean',
'type' => 'bool',
'required' => false,
'strategy' => 'exact',
'is_collection' => false,
],
'isDummyBoolean[]' => [
'property' => 'isDummyBoolean',
'type' => 'bool',
'required' => false,
'strategy' => 'exact',
'is_collection' => true,
],
], $filter->getDescription($this->resourceClass));
}

Expand Down

0 comments on commit 39c8920

Please sign in to comment.