Skip to content

[php-laravel] Use baseName instead of paramName for request lookup & validation keys#24400

Merged
wing328 merged 2 commits into
OpenAPITools:masterfrom
holkerveen:fix/php-laravel-basename-request-lookups
Jul 24, 2026
Merged

[php-laravel] Use baseName instead of paramName for request lookup & validation keys#24400
wing328 merged 2 commits into
OpenAPITools:masterfrom
holkerveen:fix/php-laravel-basename-request-lookups

Conversation

@holkerveen

@holkerveen holkerveen commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Description

Hi there! Wanted to share one of the modifications we made to the php-laravel generator templates. This commit aims to fix a bug caused by case inconsistencies.

The php-laravel server templates read request values and build validation rules keyed by paramName — the sanitized PHP identifier — instead of baseName. Laravel does not convert casing though, so request variables do not get parsed correctly.

Example

Given a query parameter filter_name:

Before (generated — broken)

// In generated controller
$filterName = $request->string('filterName')->value(); // wire key is `filter_name` -> always null

Validator::make($request->all(), [
    'filterName' => ['string'],   // never matches the incoming `filter_name`
]);

After (generated — fixed)

$filterName = $request->string('filter_name')->value();

$validator = Validator::make($request->all(), [
    'filter_name' => ['string'],
]);

This is mostly a problem for form-data requests. application/json is handled using Serde (de)serializer and is unaffected.
PR is against master since it does not affect the interface other than fixing the actual bug.
Route parameters are not affected since these are resolved positionally. Intentionally did not change these so the generated interface classes are unaffected.

PR checklist

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 9 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@wing328 wing328 added this to the 7.25.0 milestone Jul 24, 2026
@wing328
wing328 merged commit 53d6a1d into OpenAPITools:master Jul 24, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants