I got tired of describing the same request 3 times in Symfony
The article discusses the challenges of duplicating request contracts in Symfony APIs. It highlights the author's solution of creating a Symfony bundle to reduce redundancy by using a single JSON Schema for validation and OpenAPI generation. This approach aims to streamline the API development process while maintaining clarity in request contracts.
- ▪The author faced issues with duplicating request contracts in Symfony APIs.
- ▪A new Symfony bundle was created to minimize this duplication by using a single JSON Schema.
- ▪The solution aims to reduce boilerplate code while keeping request contracts explicit.
Opening excerpt (first ~120 words) tap to expand
try { if(localStorage) { let currentUser = localStorage.getItem('current_user'); if (currentUser) { currentUser = JSON.parse(currentUser); if (currentUser.id === 3808514) { document.getElementById('article-show-container').classList.add('current-user-is-article-author'); } } } } catch (e) { console.error(e); } David Evdoshchenko Posted on May 29 I got tired of describing the same request 3 times in Symfony #symfony #api #validation #json When building Symfony APIs, I kept duplicating the same request contract: validation rules in a DTO OpenAPI schema (often separately) mapping / glue code around it After enough endpoints, the API layer started feeling heavier than the business logic.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at DEV.to (Top).