adrenalinkin/swagger-resolver-bundle
Symfony bundle that validates request/response data against Swagger 2 (OpenAPI) specs. Generates a SwaggerResolver based on Symfony OptionsResolver, with warmed caching and debug auto-refresh. Loads docs via NelmioApiDocBundle, swagger-php, or JSON/YAML files.
Adopt When:
Look Elsewhere If:
respect/validation for edge cases)."This package lets us automatically enforce our API contracts—meaning every request to our system will match the documented specs. This reduces bugs from invalid data, cuts manual testing time, and ensures our API stays consistent as it evolves. For example, if we update our Swagger docs for a new feature, the validation rules update too—no extra work. It’s like a safety net for our API, saving dev time and improving reliability."
Key Outcomes:
*"This Laravel bundle validates API payloads against Swagger specs at runtime, replacing manual validation logic with auto-generated rules. It’s a drop-in solution that:
SwaggerResolverValidator to your PHPUnit tests to catch schema violations early.Example Use Case:
// Instead of this:
$request->validate([
'user.id' => 'required|integer',
'user.name' => 'string|max:255',
]);
// Do this (auto-generated from Swagger):
$validator = new SwaggerResolverValidator($swaggerSpec);
$validator->validate($request->all());
Trade-offs:
Next Steps:
How can I help you explore Laravel packages today?