[Elixir] fix parameter name with {{baseName}} #5021
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR checklist
./bin/to update Petstore sample so that CIs can verify the change.→ bin/elixir-petstore.sh
Description of the PR
This fixes (or hopes to fix) part of #4898 for the
elixirgenerator.The problem likely occurred when a query/form/header parameter name (as declared in the OpenAPI definition) is of a form which doesn't match the form used in Elixir, or is a reserved word there. In this case the parameter gets renamed for use in the code, and the algorithm for including the parameter in the request uses the sanitized name instead of the original one.
This commit changes the replacement to using
{{baseName}}(which is the original name of the parameter definition as parsed from the API definition) instead of{{paramName}}(which is the sanitized version of the parameter name).There are some places in the Petstore samples where this makes some difference, to me it looks like the new ones are more sensible.
I don't know anything about Elixir (don't even have a compiler on my computer), so this needs intensive review by Elixir experts. /cc @niku