Skip to content

NO-ISSUE: Fix form param keys for openapi-generator#823

Draft
mokuzon wants to merge 3 commits into
masterfrom
users/mokuson/NO-ISSUE/fix-openapi-7.21-form-params
Draft

NO-ISSUE: Fix form param keys for openapi-generator#823
mokuzon wants to merge 3 commits into
masterfrom
users/mokuson/NO-ISSUE/fix-openapi-7.21-form-params

Conversation

@mokuzon
Copy link
Copy Markdown

@mokuzon mokuzon commented Apr 21, 2026

resolve #810

Summary

  • openapi-generator 7.21.0 changed the PHP api.mustache template to use {{paramName}} (camelCase) as form data keys in FormDataProcessor::prepare(), instead of {{baseName}} (snake_case)
  • This causes incorrect request bodies (e.g. grantType=client_credentials instead of grant_type=client_credentials), breaking all form-based endpoints
  • Add a custom api.mustache override with a single-line fix: '{{baseName}}' instead of '{{paramName}}'

Test plan

  • Ran python generate-code.py with 7.21.0 locally and check diff of auto generated codes
  • All 23 tests pass (674 assertions), including the previously failing issueStatelessChannelToken tests

@mokuzon mokuzon marked this pull request as draft April 21, 2026 06:28
@renovate renovate Bot force-pushed the renovate/openapi-generator-version branch from 6d2ab46 to 610fd0b Compare April 27, 2026 05:23
@renovate renovate Bot force-pushed the renovate/openapi-generator-version branch from 610fd0b to f9ebe70 Compare May 5, 2026 11:34
Base automatically changed from renovate/openapi-generator-version to master May 5, 2026 11:38
@mokuzon mokuzon force-pushed the users/mokuson/NO-ISSUE/fix-openapi-7.21-form-params branch 2 times, most recently from cec5fc7 to eb1e4bf Compare May 19, 2026 05:36
@mokuzon mokuzon changed the title NO-ISSUE: Fix form param keys for openapi-generator 7.21.0 NO-ISSUE: Fix form param keys for openapi-generator May 19, 2026
@mokuzon mokuzon force-pushed the users/mokuson/NO-ISSUE/fix-openapi-7.21-form-params branch 4 times, most recently from ba9bbeb to 9d20e66 Compare May 19, 2026 06:01
@mokuzon mokuzon force-pushed the users/mokuson/NO-ISSUE/fix-openapi-7.21-form-params branch from ea77e56 to 541b70a Compare May 19, 2026 06:08
{{/collectionFormat}}
if (${{paramName}} !== null) {
$resourcePath = str_replace(
'{' . '{{baseName}}' . '}',
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.

このテンプレートのカスタマイズ箇所はこの1行のみ

openapi-generator 7.22.0 の元の api.mustache と比較すると、差分はこの 643 行目のみです。

# Line 643 (path param URL substitution)
- {{=<< >>=}}'{<<baseName>>}'<<={{ }}=>>,        # 7.22.0 upstream
+ '{' . '{{baseName}}' . '}',                    # custom

両者ともパスパラメータの置換用文字列 (例: '{audienceGroupId}') を生成しますが、生成される PHP コードが異なります:

  • upstream: '{audienceGroupId}' (string literal)
  • custom: '{' . 'audienceGroupId' . '}' (string concatenation)

実行時の挙動は同じです。

注意: form param key の修正は upstream で既に対応済み

この PR のタイトルにある「form param keys の修正」は、もともと openapi-generator 7.21.0 で '{{paramName}}' => $... (camelCase) になっていたバグを直すためでしたが、7.22.0 で upstream 修正されています:

# Line 657
7.21.0:  '{{paramName}}' => ${{paramName}},   # bug (camelCase)
7.22.0:  '{{baseName}}'  => ${{paramName}},   # fixed upstream
custom:  '{{baseName}}'  => ${{paramName}},   # same as 7.22.0

つまり 7.22.0 + custom api.mustache 構成では、Line 643 のスタイル違いのみが残っており、もしこの違いに技術的理由がなければ custom api.mustache 自体が不要になる可能性があります。

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