Skip to content

Add PHP QueryParameter import after property renaming#7989

Open
AayushP123 wants to merge 1 commit into
microsoft:mainfrom
AayushP123:codex/fix-php-query-parameter-import
Open

Add PHP QueryParameter import after property renaming#7989
AayushP123 wants to merge 1 commit into
microsoft:mainfrom
AayushP123:codex/fix-php-query-parameter-import

Conversation

@AayushP123

Copy link
Copy Markdown
Contributor

Summary

Evaluates the PHP QueryParameter import after query property names are normalized. Adds regression coverage for snake_case query parameters that become camelCase while retaining their serialization name.

The import evaluator previously ran before ReplacePropertyNames populated SerializationName, so generated annotations could be emitted without the corresponding import.

Validation

dotnet test tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj --no-restore --nologo --filter 'FullyQualifiedName~Refiners.PhpLanguageRefinerTests' (14 passed)

Fixes #7602

@AayushP123
AayushP123 requested a review from a team as a code owner July 26, 2026 07:16
Copilot AI review requested due to automatic review settings July 26, 2026 07:16

Copilot AI 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.

Pull request overview

This PR fixes a PHP generation bug where the @QueryParameter("...") docblock annotation could be emitted without importing Microsoft\Kiota\Abstractions\QueryParameter when query parameter property names are normalized (e.g., snake_casecamelCase). It adjusts the PHP refiner’s import evaluation order so the import decision occurs after SerializationName is populated, and adds a regression test for the scenario reported in #7602.

Changes:

  • Run an additional PHP default-import evaluation pass specifically for QueryParameter after ReplacePropertyNames has set SerializationName.
  • Refactor the QueryParameter import evaluator into a dedicated evaluator list to ensure it’s applied at the correct stage.
  • Add a regression test validating both the renaming (category_idcategoryId) and the presence of the QueryParameter import.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Kiota.Builder/Refiners/PhpRefiner.cs Ensures QueryParameter import is added after query-parameter property renaming populates SerializationName.
tests/Kiota.Builder.Tests/Refiners/PhpLanguageRefinerTests.cs Adds regression coverage for snake_case query parameters retaining correct serialization name and import.

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.

PHP generator omits QueryParameter class import for snake_case query parameters

2 participants