WeSearch

I got tired of describing the same request 3 times in Symfony

·1 min read · 0 reactions · 0 comments · 8 views
#symfony#api#validation#json
I got tired of describing the same request 3 times in Symfony
⚡ TL;DR · AI summary

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.

Key facts
Original article
DEV.to (Top)
Read full at DEV.to (Top) →
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).

Anonymous · no account needed
Share 𝕏 Facebook Reddit LinkedIn Threads WhatsApp Bluesky Mastodon Email

Discussion

0 comments

More from DEV.to (Top)