
I had to build my own Symfony validation bundle because no existing one fits my requirements
Contents Long story short The Problem The Idea The Solution Quick Examples Example 1 Example 2 What's the result? The Full Story Long story short I created a bundle for request validation with JSON Schema because no existing "schema-first" validator fit my requirements. Now I just attach a JSON file to a route and get everything at once: validation, DTO mapping, and OpenAPI documentation from a single source of truth. Repo: https://github.com/outcomer/symfony-json-schema-validation Docs: https://outcomer.github.io/symfony-json-schema-validation/ The Problem Most validation solutions that can generate API documentation from code (in the Symfony world I mostly mean FOSRestBundle and API Platform) assume that your business logic is: Well defined and relatively stable Close to a classic CRUD model (or CRUD with small deviations) Exposed via clean, REST-style endpoints that you fully control In other words, they assume your application defines the contract and the outside world adapts to it
Continue reading on Dev.to
Opens in a new tab


