feat: container-resolved FormRequest detection and improved example generation#21
Merged
Merged
Conversation
added 6 commits
February 13, 2026 10:20
Add ContainerFormRequestAnalyzer that detects FormRequests resolved through the service container (resolve(SomeRequest::class) or app(SomeRequest::class)) in controller method bodies. Traces into $this->helperMethod() calls recursively (up to 3 levels) with a return-type shortcut for methods typed as FormRequest subclasses. Registered at priority 85 between FormRequestAnalyzer (90) and InlineValidationAnalyzer (80).
Abort calls now emit a proper JSON error schema with a message property instead of an empty response body. Added 405 and 501 to the status description map.
Extend ValidationErrorAnalyzer to recognize resolve()/app() calls and trace through $this->helperMethod() chains (up to 3 levels deep) so endpoints using container-resolved FormRequests correctly produce a 422 Validation Error response in the spec.
Cover direct resolve/app, helper method tracing, nested helper tracing, 422 error responses, abort-only methods with error schemas, and abort 501 responses.
ExampleGenerator: - Recurse into properties regardless of type (fixes wildcard validation schemas) - Add oneOf/anyOf/allOf recursion for composition schemas - Add ~60 new field name heuristics (person names, address, currency, pagination, dimensions, boolean prefixes, content fields, etc.) - Add time, hostname, password, byte format examples PaginationPlugin: - Add examples directly to pagination metadata arrays since they are injected after ExampleGenerator has already processed the schema Improves property example coverage from 64% to 82% on real-world apps.
Cover oneOf/anyOf/allOf recursion, non-object-type schemas with properties, person name heuristics, address heuristics, pagination field heuristics, boolean field name detection, and new format examples (time, byte).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
resolve()/app()FormRequests — NewContainerFormRequestAnalyzerextracts requestbody schemas from
resolve(SomeRequest::class)andapp(SomeRequest::class)calls in controllermethod bodies, including recursive tracing through
$this->helperMethod()chains (up to 3 levelsdeep)
ValidationErrorAnalyzernowrecognizes the same patterns so endpoints correctly produce 422 responses in the spec
abort(405)/abort(501)etc. now emit a proper{"message": "string"}schema instead of an empty bodyheuristics (person names, addresses, pagination, currency, boolean prefixes, etc.), and examples
directly in pagination metadata