Open xMAC94x opened 1 day ago
I have a local branch with a solution, however it slaps a lot of
{{#vendorExtensions.x-group-parameters}}
params.{{paramName}}
{{/vendorExtensions.x-group-parameters}}
{{^vendorExtensions.x-group-parameters}}
{{paramName}}
{{/vendorExtensions.x-group-parameters}}
all over the place.
acording to some mustache
documentation, stuff like this should prob handled on the logic side. E.g. we could add a paramNameWithPrefix
somewhere and just use that. however in the java
code this seems to be handled in the CodegenParameter.java
file, And i dont want to touch the base class for all languages in my PR, what do you recommend ?
Any help here for a good place to add that parameter ? ideally so that it only affects rust generation ? Thanks for the help
Is your feature request related to a problem? Please describe.
I'm always frustrated when I try to read the api code and the only thing i see is
local_var_
everywhere, makes it really hard to focus on the code.Describe the solution you'd like
get rid of
local_var_
Additional context
The majority of languages supported don't have
local_var_
. So it seems like most of this coding is 3-4 years old, I found one specific issue linked to this: #10421 , It's kinda hard to reproduce whats the original error, because the referenced logs are long gone. but from they change: #10419 I guess that have a parameter calledconfiguration
and then wanted to generate the source code with the flaguseSingleRequestParameter
.That results in a problem when
unboxing
the single parameter here: https://github.com/OpenAPITools/openapi-generator/blob/47665aaa97cb1975c5382165f9048eeb9918034f/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache#L88The solution kinda works, because the internal variable is no longer called
configuration
but nowlocal_var_configuration
. However this makes it very hard to read and will fails as soon as someone tries to insert a parameterlocal_var_configuration
.Knowing that most of the code is ~3 years old I can imagine the borrow checker having problems back then which needed this
unboxing
. However we could prob completely avoid it, and thus avoid any problems due to parameter names.Note: as you have seen, this issue could also be interpreted as [BUG]. For me its a feature, because I want to read the code, but if you want me to rephrase it, just tell me and I will open another ticket.
Example
vs