The problems we solve
-
Doctrine entities exposed as they are: every schema change breaks the API.
-
Serialization groups that are impossible to follow.
-
N+1 queries on every collection.
-
OpenAPI documentation that does not match the actual behavior.
-
Files created by root in the development containers.
What we put in place
-
API resources as DTOs, separate from the entities.
-
Testable providers, processors and mappers.
-
Accurate OpenAPI documentation.
-
A clean Docker and FrankenPHP environment.
Articles
API Platform: a readable ComparisonFilter in OpenAPI
Up to 4.4.2, ComparisonFilter documents each operator as an object, then as a string. Type them with openApi, validate with constraints, avoid the schema trap.
Updated on Oct 02, 20264 min read
API Platform: separate Doctrine entities from API resources
Exposing Doctrine entities ties the database to the API contract. DTO resources, stateOptions and explicit providers keep pagination, filters and extensions.
Updated on Oct 02, 202611 min read
API Platform and ObjectMapper: the pitfalls of DTO resources
#[Map] ignored without a source, relations, genid IRIs, a PATCH that erases a field. The ObjectMapper pitfalls with API Platform 4.4 and 5.0, checked in code.
Updated on Oct 02, 202611 min read