Releases: api-platform/core
Version 2.4.4
- Store the original data in the
previous_data
request attribute, and allow to access it in security expressions using theprevious_object
variable (useful for PUT and PATCH requests) - Fix resource inheritance handling
- Fix BC break in
AbstractItemNormalizer
introduced in 2.4 - Fix serialization when using interface as resource
- Basic compatibility with Symfony 4.3
Version 2.4.3
-
Doctrine: allow autowiring of filter classes
-
Doctrine: don't use
fetchJoinCollection
onPaginator
when not needed -
Doctrine: fix a BC break in
OrderFilter
-
GraphQL: input objects aren't nullable anymore (compliance with the Relay spec)
-
Cache: Remove some useless purges
-
Mercure: publish to Mercure using the default response format
-
Mercure: use the Serializer context
-
OpenAPI: fix documentation of the
PropertyFilter
-
OpenAPI: fix generation of the
servers
block (also fixes the compatibility with Postman) -
OpenAPI: skip not readable and not writable properties from the spec
-
OpenAPI: add the
id
path parameter for POST item operation -
Serializer: add support for Symfony Serializer's
@SerializedName
metadata -
Metadata:
ApiResource
'sattributes
property now defaults tonull
, as expected -
Metadata: Fix identifier support when using an interface as resource class
-
Metadata: the HTTP method is now always uppercased
-
Allow to disable listeners per operation (fix handling of empty request content)
Previously, empty request content was allowed for any
POST
andPUT
operations. This was an unsafe assumption which caused other problems.If you wish to allow empty request content, please add
"deserialize"=false
to the operation's attributes. For example:<?php // api/src/Entity/Book.php use ApiPlatform\Core\Annotation\ApiResource; use App\Controller\PublishBookAction; /** * @ApiResource( * itemOperations={ * "put_publish"={ * "method"="PUT", * "path"="/books/{id}/publish", * "controller"=PublishBookAction::class, * "deserialize"=false, * }, * }, * ) */ class Book {
You may also need to add
"validate"=false
if the controller result isnull
(possibly because you don't need to persist the resource). -
Return the
204
HTTP status code when the output class is set tonull
-
Be more resilient when normalizing non-resource objects
-
Replace the
data
request attribute by the return of the data persister -
Fix error message in identifiers extractor
-
Improve the bundle's default configuration when using
symfony/symfony
is required -
Fix the use of
MetadataAwareNameConverter
when available (configuringname_converter: serializer.name_converter.metadata_aware
will now result in a circular reference error)
Version 2.4.2
- Fix a dependency injection injection problem in
FilterEagerLoadingExtension
- Improve performance by adding a
NoOpScalarNormalizer
handling scalar values
Version 2.4.1
- Improve performance of the dev environment and deprecate the
api_platform.metadata_cache
parameter - Fix a BC break in
SearchFilter
- Don't send HTTP cache headers for unsuccessful responses
- GraphQL: parse input and messenger metadata on the GraphQl operation
- GraphQL: do not enable graphql when
webonyx/graphql-php
is not installed
Version 2.4.0
See the announcement on Kévin's blog for a curated list of the changes.
- Listeners are now opt-in when not handling API Platform operations
DISTINCT
is not used when there are no joins- Preserve manual join in FilterEagerLoadingExtension
- The
elasticsearch
attribute can be disabled resource-wise or per-operation - The
messenger
attribute can now take theinput
string as a value (messenger="input"
). This will use a default transformer so that the giveninput
is directly sent to the messenger handler. - The
messenger
attribute can be declared per-operation - Mercure updates are now published after the Doctrine flush event instead of on
kernel.terminate
, so the Mercure and the Messenger integration can be used together - Use Symfony's MetadataAwareNameConverter when available
- Change the extension's priorities (
<0
) for improved compatibility with Symfony's autoconfiguration feature. If you have custom extensions we recommend to use positive priorities.
Service name | Priority | Class |
---|---|---|
api_platform.doctrine.orm.query_extension.eager_loading (collection) | -8 | ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\EagerLoadingExtension |
api_platform.doctrine.orm.query_extension.eager_loading (item) | -8 | ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\EagerLoadingExtension |
api_platform.doctrine.orm.query_extension.filter | -16 | ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\FilterExtension |
api_platform.doctrine.orm.query_extension.filter_eager_loading | -17 | ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\FilterEagerLoadingExtension |
api_platform.doctrine.orm.query_extension.order | -32 | ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\OrderExtension |
api_platform.doctrine.orm.query_extension.pagination | -64 | ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\PaginationExtension |
- Fix JSON-LD contexts when using output classes
- GraphQl: Fix pagination (the
endCursor
behavior was wrong) - GraphQl: Improve output/input behavior
- GraphQl: Improve mutations (make the
clientMutationId
nullable and return mutation payload as an object) - MongoDB: Fix search filter when searching by related collection id
- MongoDB: Fix numeric and range filters
Version 2.4.0 beta 2
- Fix version constraints for Doctrine MongoDB ODM
- Respect
_api_respond
request attribute in the SerializeListener - Change the normalizer's priorities (
< 0
). If you have custom normalizer we recommend to use positive priorities.
Service name | Priority | Class |
---|---|---|
api_platform.hydra.normalizer.constraint_violation_list | -780 | ApiPlatform\Core\Hydra\Serializer\ConstraintViolationListNormalizer |
api_platform.jsonapi.normalizer.constraint_violation_list | -780 | ApiPlatform\Core\JsonApi\Serializer\ConstraintViolationListNormalizer |
api_platform.problem.normalizer.constraint_violation_list | -780 | ApiPlatform\Core\Problem\Serializer\ConstraintViolationListNormalizer |
api_platform.swagger.normalizer.api_gateway | -780 | ApiPlatform\Core\Swagger\Serializer\ApiGatewayNormalizer |
api_platform.hal.normalizer.collection | -790 | ApiPlatform\Core\Hal\Serializer\CollectionNormalizer |
api_platform.hydra.normalizer.collection_filters | -790 | ApiPlatform\Core\Hydra\Serializer\CollectionFiltersNormalizer |
api_platform.jsonapi.normalizer.collection | -790 | ApiPlatform\Core\JsonApi\Serializer\CollectionNormalizer |
api_platform.jsonapi.normalizer.error | -790 | ApiPlatform\Core\JsonApi\Serializer\ErrorNormalizer |
api_platform.hal.normalizer.entrypoint | -800 | ApiPlatform\Core\Hal\Serializer\EntrypointNormalizer |
api_platform.hydra.normalizer.documentation | -800 | ApiPlatform\Core\Hydra\Serializer\DocumentationNormalizer |
api_platform.hydra.normalizer.entrypoint | -800 | ApiPlatform\Core\Hydra\Serializer\EntrypointNormalizer |
api_platform.hydra.normalizer.error | -800 | ApiPlatform\Core\Hydra\Serializer\ErrorNormalizer |
api_platform.jsonapi.normalizer.entrypoint | -800 | ApiPlatform\Core\JsonApi\Serializer\EntrypointNormalizer |
api_platform.problem.normalizer.error | -810 | ApiPlatform\Core\Problem\Serializer\ErrorNormalizer |
serializer.normalizer.json_serializable | -900 | Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer |
serializer.normalizer.datetime | -910 | Symfony\Component\Serializer\Normalizer\DateTimeNormalizer |
serializer.normalizer.constraint_violation_list | -915 | Symfony\Component\Serializer\Normalizer\ConstraintViolationListNormalizer |
serializer.normalizer.dateinterval | -915 | Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer |
serializer.normalizer.data_uri | -920 | Symfony\Component\Serializer\Normalizer\DataUriNormalizer |
api_platform.graphql.normalizer.item | -922 | ApiPlatform\Core\GraphQl\Serializer\ItemNormalizer |
api_platform.hal.normalizer.item | -922 | ApiPlatform\Core\Hal\Serializer\ItemNormalizer |
api_platform.jsonapi.normalizer.item | -922 | ApiPlatform\Core\JsonApi\Serializer\ItemNormalizer |
api_platform.jsonld.normalizer.item | -922 | ApiPlatform\Core\JsonLd\Serializer\ItemNormalizer |
api_platform.serializer.normalizer.item | -923 | ApiPlatform\Core\Serializer\ItemNormalizer |
serializer.normalizer.object | -1000 | Symfony\Component\Serializer\Normalizer\ObjectNormalizer |
- Allow custom stylesheets to be appended or replaced in the swagger UI
- Load messenger only if available
- Fix missing metadata cache pool for Elasticsearch
- Make use of the new AdvancedNameConverterInterface interface for name converters
- Refactor input/output attributes, where these attributes now take:
- an array specifying a class and some specific attributes (
name
andiri
if needed) - a string representing the class
- a
falsy
boolean to disable the input/output
- an array specifying a class and some specific attributes (
- Introduce the DataTransformer concept to transform an input/output from/to a resource
- Api Platform normalizer is not limited to Resources anymore (you can use DTO as relations and more...)
- MongoDB: allow a
0
limit in the pagination - Fix support of a discriminator mapping in an entity
Version 2.4.0 beta 1
See https://dunglas.fr/2019/01/api-platform-2-4/
Full changelog:
- MongoDB: full support
- Elasticsearch: add reading support (including pagination, sort filter and term filter)
- Mercure: automatically push updates to clients using the Mercure protocol
- CQRS support and async message handling using the Symfony Messenger Component
- OpenAPI: add support for OpenAPI v3 in addition to OpenAPI v2
- OpenAPI: support generating documentation using ReDoc
- OpenAPI: basic hypermedia hints using OpenAPI v3 links
- OpenAPI: expose the pagination controls
- Allow to use custom classes for input and output (DTO) with the
input_class
andoutput_class
attributes - Allow to disable the input or the output by setting
input_class
andoutput_class
to false - Guess and automatically set the appropriate Schema.org IRIs for common validation constraints
- Allow to set custom cache HTTP headers using the
cache_headers
attribute - Allow to set the HTTP status code to send to the client through the
status
attribute - Add support for the
Sunset
HTTP header using thesunset
attribute - Set the
Content-Location
andLocation
headers when appropriate for better RFC7231 conformance - Display the matching data provider and data persiter in the debug panel
- GraphQL: improve performance by lazy loading types
- Add the
api_persist
request attribute to enable or disable theWriteListener
- Allow to set a default context in all normalizers
- Permit to use a string instead of an array when there is only one serialization group
- Add support for setting relations using the constructor of the resource classes
- Automatically set a 409 Conflict HTTP status code when an
OptimisticLockException
is thrown - Resolve Dependency Injection Container parameters in the XML and YAML files for the resource class configuration
RequestAttributesExtractor
is not internal anymore and can be used in userland code- Always use the user-defined metadata when set
- OpenAPI: add a description explaining how to use the property filter
- GraphQL: the look'n'feel of GraphiQL now match the API Platform one
- PHPStan level 6 compliance
- Add a
show_webby
configuration option to hide the spider in API docs - Add an easter egg (find it!)
Version 2.3.6
- /!\ Security: a vulnerability impacting the GraphQL subsystem was allowing users authorized to run mutations for a specific resource type, to execute it on any resource, of any type
- Fix normalization of raw collections (not API resources)
- Fix content negotiation format matching
Version 2.3.5
- GraphQL: compatibility with
webonyx/graphql-php
0.13 - OpenAPI/Swagger: expose
properties[]
as a collection parameter - OpenAPI/Swagger: add a description for the
properties[]
filter - OpenAPI/Swagger: Leverage advanced name converters
- JSON-LD: Prevent an error in
ItemNormalizer
when$context['resource_class']
is not defined - Allow to pass a the serialization group to use a string instead of as an array of one element
- Modernize the code base to use PHP 7.1 features when possible
- Bump minimal dependencies of the used Symfony components
- Improve the Packagist description
Version 2.3.4
- Open API/Swagger: fix YAML export
- Open API/Swagger: Correctly expose overridden formats
- GraphQL: display the stack trace when in debug mode
- GraphQL: prevent a crash when the class name isn't provided
- Fix handling of one-to-one relations in subresources
- Fix max depth handling when eager fetching is disabled
- Compatibility with Symfony 4.2
- Prevent calling the remove method from all data persisters
- Persist Doctrine entities with the
DEFERRED_EXPLICIT
change tracking policy - Throw an
InvalidArgumentException
when trying to get an item from a collection route - Improve the debug bar panel visibility
- Take into account the
route_prefix
attribute in subresources - Allow to use multiple values with
NumericFilter
- Improve exception handling in
ReadListener
by adding the previous exception