Skip to content

feat: container-resolved FormRequest detection and improved example generation#21

Merged
jkbennemann merged 6 commits into
mainfrom
feature/improved-detection-and-examples
Feb 13, 2026
Merged

feat: container-resolved FormRequest detection and improved example generation#21
jkbennemann merged 6 commits into
mainfrom
feature/improved-detection-and-examples

Conversation

@jkbennemann

Copy link
Copy Markdown
Owner

Summary

  • Detect resolve()/app() FormRequests — New ContainerFormRequestAnalyzer extracts request
    body schemas from resolve(SomeRequest::class) and app(SomeRequest::class) calls in controller
    method bodies, including recursive tracing through $this->helperMethod() chains (up to 3 levels
    deep)
  • 422 validation errors for container-resolved FormRequestsValidationErrorAnalyzer now
    recognizes the same patterns so endpoints correctly produce 422 responses in the spec
  • Error schemas on abort() responsesabort(405) / abort(501) etc. now emit a proper
    {"message": "string"} schema instead of an empty body
  • Improved example generation (64% → 82%) — Added oneOf/anyOf/allOf recursion, ~60 new field name
    heuristics (person names, addresses, pagination, currency, boolean prefixes, etc.), and examples
    directly in pagination metadata

jakob.bennemann 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).
@jkbennemann jkbennemann merged commit d54b22c into main Feb 13, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant