Skip to content

feat: Response schema $ref deduplication and type accuracy improvements#23

Merged
jkbennemann merged 4 commits into
mainfrom
feature/response-ref-dedup-and-type-accuracy
Feb 13, 2026
Merged

feat: Response schema $ref deduplication and type accuracy improvements#23
jkbennemann merged 4 commits into
mainfrom
feature/response-ref-dedup-and-type-accuracy

Conversation

@jkbennemann

Copy link
Copy Markdown
Owner

Summary

  • Register error response schemas (401/403/404/422/429) as shared $ref components instead of repeating identical inline schemas on every route
  • Add database column introspection as a fallback for resolving property types when casts, accessors, and PHPDoc are unavailable
  • Improve request body analysis with enum resolution from validation rules and $ref registration for FormRequest schemas
  • Enhance JsonResource analysis with explicit cast detection, Resource::collection() handling, and string literal enum inference

jakob.bennemann added 4 commits February 13, 2026 16:05
- Update Node\Expr\ArrayItem to Node\ArrayItem across analyzers and plugins
- Add resolveSchemaRef test helper to TestCase for $ref-aware assertions
- Add auto_detect_api_routes config to filter non-API routes automatically
- Use getRoutes()->getRoutes() for proper route iteration
- Ensure array schemas always include items (OpenAPI best practice)
- Use SchemaObject for rate limit response headers
- Fix PHPDoc header type on ResponseResult
- Remove unused ResultMerger and TypeMapper from ReturnTypeAnalyzer
- Fix ClassSchemaResolver::resolveSpatieData return type
…am improvements

- Register FormRequest schemas as components via SchemaRegistry for $ref reuse
- Resolve enum classes from validation rules (Enum::class) into OpenAPI enum schemas
- Support array_merge() and conditional rule merging in FormRequest AST parsing
- Add DELETE to query-method list for FormRequestQueryAnalyzer
- Detect $request['key'] array access as query parameters
- Recognize additional request variable names ($req, $rq) and $request->get()
- Update tests to use resolveSchemaRef for $ref-aware assertions
…ection

- Detect explicit type casts ((int), (bool), (float), (array)) in resource arrays
- Handle Resource::collection() static calls as array-wrapped schemas
- Treat string literals as single-value enums for type discriminators
- Add database column introspection as step 5 in EloquentModelAnalyzer
- Map DB column types (integer, boolean, datetime, etc.) to OpenAPI schemas
- Graceful fallback when no database connection is available
- Register error response schemas (401/403/404/422/429) as shared components
  in PathBuilder via SchemaRegistry, eliminating duplicate inline schemas
- Map error sources to named components (AuthenticationError, ValidationError, etc.)
- Pass SchemaRegistry to PathBuilder, request analyzers, and CodeSamplePlugin
- Resolve $ref schemas in CodeSamplePlugin example extraction
- Wire SchemaRegistry through ServiceProvider to all analyzers and plugins
- Update error response tests to use resolveSchemaRef helper
@jkbennemann jkbennemann merged commit 55dbf33 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