davsclaus opened a new pull request, #29099: URL: https://github.com/apache/camel/pull/29099
Fixes [CAMEL-26245](https://issues.apache.org/jira/browse/CAMEL-26245). ## What was wrong API components can rename a method argument with `<substitution>` in their `pom.xml`. The generated `*ApiMethod` enum and the endpoint options use the new name, but the signatures in `@ApiMethod(signatures = ...)` kept the name from the parsed source. Those signatures go into the catalog. Example from google-mail: the catalog showed `modify(String userId, String id, ModifyMessageRequest content)`, but the option is `modifyMessageRequest`. A user who set `inBody=content` got "No matching method" when the endpoint was created. ## What changed - `AbstractApiMethodGeneratorMojo` now writes each signature with the argument names of the method model after substitution. It replaces only the name after each top-level argument (commas inside generics are skipped). If the signature has more arguments than the model, the signature is kept as-is. - Regenerated the six components that use substitutions, and copied their JSON to the catalog: braintree, google-calendar, google-drive, google-mail, google-sheets, zendesk. Only the signature text changes. - Before, 54 argument names in those signatures did not match an endpoint option. Now all of them match: braintree 7, google-calendar 5, google-drive 7, google-mail 3, google-sheets 9, zendesk 23. - I also regenerated the other API components (as2, box, dhis2, fhir, olingo2, olingo4, twilio). They have no substitutions, and nothing changed. ## Tests - `ApiJavaSourceComponentGeneratorMojoTest.testSignaturesUseSubstitutedArgumentNames` runs the generator on `TestProxy` with three substitutions (by name, by type, varargs) and checks the generated signatures. It fails without the fix. - `SignatureWithArgumentNamesTest` covers the helper: generics that contain commas, extra options appended after the signature arguments, and the case where the arguments do not match. - Plugin module with `-Psourcecheck`: 15 tests, all pass. Unit tests of the six regenerated components pass. ## Not changed - `ArgumentSubstitutionParser` (camel-support) still keeps the original signature on the model. The fix is in the plugin, so core is not touched. - No upgrade guide entry. Only the documented signatures change; endpoint options and runtime behaviour stay the same. - A few signature arguments in as2 (`handler`) and box (`listener`) are not endpoint options, because `excludeConfigNames`/`excludeConfigTypes` exclude them. That is unrelated to substitutions. _Claude Code on behalf of Claus Ibsen (davsclaus)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
