Skip to content

Commit

Permalink
Merge 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka committed Nov 6, 2023
2 parents 6606dd4 + b1b4f14 commit 002c8b2
Show file tree
Hide file tree
Showing 41 changed files with 555 additions and 126 deletions.
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## v3.2.4

### Bug fixes

* [436921f3b](https://github.com/api-platform/core/commit/436921f3bfb15f77f3d6f9c7462df7882120cd37) fix(serializer): json violation list normalizer (#5941)

## v3.2.3

### Bug fixes

* [0f015214c](https://github.com/api-platform/core/commit/0f015214c311c31f4065d3c4b3c171c3152a4e64) fix(symfony): 404 wrongly normalized (#5936)
* [495f75f81](https://github.com/api-platform/core/commit/495f75f811aedee491e3e419ca9d7040aea7355c) fix(serializer): json non-resource intermitent class (#5937)

## v3.2.2

### Bug fixes
Expand Down Expand Up @@ -1892,4 +1905,4 @@ Please read #2825 if you have issues with the behavior of Readable/Writable Link
## 1.0.0 beta 2

* Preserve indexes when normalizing and denormalizing associative arrays
* Allow setting default order for property when registering a `Doctrine\Orm\Filter\OrderFilter` instance
* Allow setting default order for property when registering a `Doctrine\Orm\Filter\OrderFilter` instance
12 changes: 12 additions & 0 deletions features/issues/5926.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Feature: Issue 5926
In order to reproduce the issue at https://github.com/api-platform/core/issues/5926
As a client software developer
I need to be able to use every operation on a resource with non-resources embed objects

@!mongodb
Scenario: Create and retrieve a WriteResource
When I add "Accept" header equal to "application/json"
And I send a "GET" request to "/test_issue5926s/1"
Then the response status code should be 200
And the response should be in JSON
And the header "Content-Type" should be equal to "application/json; charset=utf-8"
31 changes: 31 additions & 0 deletions features/main/validation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,34 @@ Feature: Using validations groups
]
}
"""

@!mongodb
Scenario: Get violations constraints
When I add "Accept" header equal to "application/json"
And I add "Content-Type" header equal to "application/json"
And I send a "POST" request to "/issue5912s" with body:
"""
{
"title": ""
}
"""
Then the response status code should be 422
And the response should be in JSON
And the JSON should be equal to:
"""
{
"status": 422,
"violations": [
{
"propertyPath": "title",
"message": "This value should not be blank.",
"code": "c1051bb4-d103-4f74-8988-acbcafc7fdc3"
}
],
"detail": "title: This value should not be blank.",
"type": "/validation_errors/c1051bb4-d103-4f74-8988-acbcafc7fdc3",
"title": "An error occurred"
}
"""
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"

6 changes: 4 additions & 2 deletions src/Doctrine/Odm/Filter/BooleanFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
*
* Syntax: `?property=<true|false|1|0>`.
*
* <CodeSelector>
* <div data-code-selector>
*
* ```php
* <?php
* // api/src/Entity/Book.php
Expand Down Expand Up @@ -94,7 +95,8 @@
* </resource>
* </resources>
* ```
* </CodeSelector>
*
* </div>
*
* Given that the collection endpoint is `/books`, you can filter books with the following query: `/books?published=true`.
*
Expand Down
6 changes: 4 additions & 2 deletions src/Doctrine/Odm/Filter/DateFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
* - Consider items as youngest: use `ApiPlatform\Doctrine\Odm\Filter\DateFilter::INCLUDE_NULL_AFTER` (`include_null_after`) strategy
* - Always include items: use `ApiPlatform\Doctrine\Odm\Filter\DateFilter::INCLUDE_NULL_BEFORE_AND_AFTER` (`include_null_before_and_after`) strategy
*
* <CodeSelector>
* <div data-code-selector>
*
* ```php
* <?php
* // api/src/Entity/Book.php
Expand Down Expand Up @@ -107,7 +108,8 @@
* </resource>
* </resources>
* ```
* </CodeSelector>
*
* </div>
*
* Given that the collection endpoint is `/books`, you can filter books by date with the following query: `/books?createdAt[after]=2018-03-19`.
*
Expand Down
6 changes: 4 additions & 2 deletions src/Doctrine/Odm/Filter/ExistsFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
*
* Syntax: `?exists[property]=<true|false|1|0>`.
*
* <CodeSelector>
* <div data-code-selector>
*
* ```php
* <?php
* // api/src/Entity/Book.php
Expand Down Expand Up @@ -98,7 +99,8 @@
* </resource>
* </resources>
* ```
* </CodeSelector>
*
* </div>
*
* Given that the collection endpoint is `/books`, you can filter books with the following query: `/books?exists[comment]=true`.
*
Expand Down
6 changes: 4 additions & 2 deletions src/Doctrine/Odm/Filter/NumericFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
*
* Syntax: `?property=<int|bigint|decimal...>`.
*
* <CodeSelector>
* <div data-code-selector>
*
* ```php
* <?php
* // api/src/Entity/Book.php
Expand Down Expand Up @@ -94,7 +95,8 @@
* </resource>
* </resources>
* ```
* </CodeSelector>
*
* </div>
*
* Given that the collection endpoint is `/books`, you can filter books with the following query: `/books?price=10`.
*
Expand Down
12 changes: 8 additions & 4 deletions src/Doctrine/Odm/Filter/OrderFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
*
* Syntax: `?order[property]=<asc|desc>`.
*
* <CodeSelector>
* <div data-code-selector>
*
* ```php
* <?php
* // api/src/Entity/Book.php
Expand Down Expand Up @@ -100,13 +101,15 @@
* </resource>
* </resources>
* ```
* </CodeSelector>
*
* </div>
*
* Given that the collection endpoint is `/books`, you can filter books by title in ascending order and then by ID in descending order with the following query: `/books?order[title]=desc&order[id]=asc`.
*
* By default, whenever the query does not specify the direction explicitly (e.g.: `/books?order[title]&order[id]`), filters will not be applied unless you configure a default order direction to use:
*
* <CodeSelector>
* <div data-code-selector>
*
* ```php
* <?php
* // api/src/Entity/Book.php
Expand Down Expand Up @@ -179,7 +182,8 @@
* </resource>
* </resources>
* ```
* </CodeSelector>
*
* </div>
*
* When the property used for ordering can contain `null` values, you may want to specify how `null` values are treated in the comparison:
* - Use the default behavior of the DBMS: use `null` strategy
Expand Down
6 changes: 4 additions & 2 deletions src/Doctrine/Odm/Filter/RangeFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
*
* Syntax: `?property[<lt|gt|lte|gte|between>]=value`.
*
* <CodeSelector>
* <div data-code-selector>
*
* ```php
* <?php
* // api/src/Entity/Book.php
Expand Down Expand Up @@ -95,7 +96,8 @@
* </resource>
* </resources>
* ```
* </CodeSelector>
*
* </div>
*
* Given that the collection endpoint is `/books`, you can filter books with the following query: `/books?price[between]=12.99..15.99`.
*
Expand Down
6 changes: 4 additions & 2 deletions src/Doctrine/Odm/Filter/SearchFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
*
* Syntax: `?property[]=foo&property[]=bar`.
*
* <CodeSelector>
* <div data-code-selector>
*
* ```php
* <?php
* // api/src/Entity/Book.php
Expand Down Expand Up @@ -129,7 +130,8 @@
* </resource>
* </resources>
* ```
* </CodeSelector>
*
* </div>
*
* @author Kévin Dunglas <[email protected]>
* @author Alan Poulain <[email protected]>
Expand Down
6 changes: 4 additions & 2 deletions src/Doctrine/Orm/Filter/BooleanFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
*
* Syntax: `?property=<true|false|1|0>`.
*
* <CodeSelector>
* <div data-code-selector>
*
* ```php
* <?php
* // api/src/Entity/Book.php
Expand Down Expand Up @@ -97,7 +98,8 @@
* </resource>
* </resources>
* ```
* </CodeSelector>
*
* </div>
*
* Given that the collection endpoint is `/books`, you can filter books with the following query: `/books?published=true`.
*
Expand Down
6 changes: 4 additions & 2 deletions src/Doctrine/Orm/Filter/DateFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
* - Consider items as youngest: use `ApiPlatform\Doctrine\Orm\Filter\DateFilter::INCLUDE_NULL_AFTER` (`include_null_after`) strategy
* - Always include items: use `ApiPlatform\Doctrine\Orm\Filter\DateFilter::INCLUDE_NULL_BEFORE_AND_AFTER` (`include_null_before_and_after`) strategy
*
* <CodeSelector>
* <div data-code-selector>
*
* ```php
* <?php
* // api/src/Entity/Book.php
Expand Down Expand Up @@ -111,7 +112,8 @@
* </resource>
* </resources>
* ```
* </CodeSelector>
*
* </div>
*
* Given that the collection endpoint is `/books`, you can filter books by date with the following query: `/books?createdAt[after]=2018-03-19`.
*
Expand Down
6 changes: 4 additions & 2 deletions src/Doctrine/Orm/Filter/ExistsFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
*
* Syntax: `?exists[property]=<true|false|1|0>`.
*
* <CodeSelector>
* <div data-code-selector>
*
* ```php
* <?php
* // api/src/Entity/Book.php
Expand Down Expand Up @@ -102,7 +103,8 @@
* </resource>
* </resources>
* ```
* </CodeSelector>
*
* </div>
*
* Given that the collection endpoint is `/books`, you can filter books with the following query: `/books?exists[comment]=true`.
*
Expand Down
6 changes: 4 additions & 2 deletions src/Doctrine/Orm/Filter/NumericFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
*
* Syntax: `?property=<int|bigint|decimal...>`.
*
* <CodeSelector>
* <div data-code-selector>
*
* ```php
* <?php
* // api/src/Entity/Book.php
Expand Down Expand Up @@ -97,7 +98,8 @@
* </resource>
* </resources>
* ```
* </CodeSelector>
*
* </div>
*
* Given that the collection endpoint is `/books`, you can filter books with the following query: `/books?price=10`.
*
Expand Down
6 changes: 4 additions & 2 deletions src/Doctrine/Orm/Filter/OrderFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
*
* Syntax: `?order[property]=<asc|desc>`.
*
* <CodeSelector>
* <div data-code-selector>
*
* ```php
* <?php
* // api/src/Entity/Book.php
Expand Down Expand Up @@ -102,7 +103,8 @@
* </resource>
* </resources>
* ```
* </CodeSelector>
*
* </div>
*
* Given that the collection endpoint is `/books`, you can filter books by title in ascending order and then by ID in descending order with the following query: `/books?order[title]=desc&order[id]=asc`.
*
Expand Down
6 changes: 4 additions & 2 deletions src/Doctrine/Orm/Filter/RangeFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
*
* Syntax: `?property[<lt|gt|lte|gte|between>]=value`.
*
* <CodeSelector>
* <div data-code-selector>
*
* ```php
* <?php
* // api/src/Entity/Book.php
Expand Down Expand Up @@ -97,7 +98,8 @@
* </resource>
* </resources>
* ```
* </CodeSelector>
*
* </div>
*
* Given that the collection endpoint is `/books`, you can filter books with the following query: `/books?price[between]=12.99..15.99`.
*
Expand Down
6 changes: 4 additions & 2 deletions src/Doctrine/Orm/Filter/SearchFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
*
* Syntax: `?property[]=foo&property[]=bar`.
*
* <CodeSelector>
* <div data-code-selector>
*
* ```php
* <?php
* // api/src/Entity/Book.php
Expand Down Expand Up @@ -129,7 +130,8 @@
* </resource>
* </resources>
* ```
* </CodeSelector>
*
* </div>
*
* @author Kévin Dunglas <[email protected]>
*/
Expand Down
6 changes: 4 additions & 2 deletions src/Elasticsearch/Filter/MatchFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
*
* Syntax: `?property[]=value`.
*
* <CodeSelector>
* <div data-code-selector>
*
* ```php
* <?php
* // api/src/Entity/Book.php
Expand Down Expand Up @@ -90,7 +91,8 @@
* </resource>
* </resources>
* ```
* </CodeSelector>
*
* </div>
*
* Given that the collection endpoint is `/books`, you can filter books by title content with the following query: `/books?title=Foundation`.
*
Expand Down
Loading

0 comments on commit 002c8b2

Please sign in to comment.