Skip to content

AC-2144: PATCH method name support - #132

Closed
Okspen wants to merge 3 commits into
paysera:masterfrom
Okspen:AC-2149-patch-support
Closed

AC-2144: PATCH method name support#132
Okspen wants to merge 3 commits into
paysera:masterfrom
Okspen:AC-2149-patch-support

Conversation

@Okspen

@Okspen Okspen commented May 28, 2026

Copy link
Copy Markdown

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for the HTTP PATCH method in the code generator. It updates the MethodNameBuilder to return 'patch' for PATCH requests instead of falling through to 'update', and updates the corresponding RAML fixtures and expected generated client code to include a patchCategory method. There are no review comments, and the changes look correct.

@Okspen
Okspen force-pushed the AC-2149-patch-support branch 5 times, most recently from e573a23 to 21a10b7 Compare June 1, 2026 09:30
Comment thread src/Paysera/Bundle/CodeGeneratorBundle/Entity/TypeConfiguration.php Outdated
@Okspen
Okspen force-pushed the AC-2149-patch-support branch from 21a10b7 to 8ad7b3c Compare June 1, 2026 09:45

@dzmitrybitsiutski dzmitrybitsiutski left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Core change looks correct and well-scoped — the PATCH/PUT name collision is properly addressed and the category fixture exercises both methods on the same resource. A few inline notes below.

Comment on lines +102 to +106
public function __construct()
{
$this->arrayItemPopulatorCode = null;
$this->arrayItemConverterCode = null;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This constructor is a no-op and unrelated to PATCH name support. $arrayItemPopulatorCode / $arrayItemConverterCode are untyped properties, so they already default to null — assigning null in the constructor changes nothing. It also looks like scope creep for this PR. Suggest removing it, or, if it was added to silence a PHPStan/static-analysis warning, please note that in the PR description.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

True, it's a leftover from the previous MR that Marius asked to add
#130 (comment)

Comment thread CHANGELOG.md

## 11.11.6
### Fixed
- PHP code generator now generates a distinct `patch` method name for PATCH endpoints instead of reusing the `update` name from PUT, avoiding collisions when both PATCH and PUT are defined on the same resource

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Worth flagging the backward-compatibility impact: this also renames generated methods for resources that have a PATCH-only endpoint (update* -> patch*), which breaks downstream code calling the old name after regeneration. Released as a patch bump under Fixed — consider calling this out explicitly as a potential BC break (or a minor bump).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

True, updated the description and version

@Okspen
Okspen requested a review from mSprunskas June 4, 2026 06:40
* @param Entities\Category $category
* @return Entities\Category
*/
public function patchCategory($id, Entities\Category $category)

@mSprunskas mSprunskas Jun 4, 2026

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.

Check https://github.com/paysera/rest-style-guide#http-methods - we don't even use PATCH, PUT should be used to updated resource.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Having separate method for PATCH doesn't hurt. Currently app-accounting-api uses PATCH method, and we cannot generate client from api-spec for it.

@Okspen Okspen closed this Jun 4, 2026
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.

3 participants