[REQ][PowerShell] Revisit list of reserved words for PowerShell
Created by: SimeonGerginov
Description
For PowerShell the list of reserved words contains words like filter, which for PowerShell Advanced functions can be passed as parameters without appending the Var prefix. Currently if the parameter name is filter, the function parameter is generated as VarFilter which adds an additional prefix which can be simplified.
For example the following is a valid PowerShell Advanced function:
function Initialize-MyFilterSpec {
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true)]
[string]
$Filter
)
$Filter
}
Initialize-MyFilterSpec -Filter 'MyFilterSpec'
For other reserved keywords like true, the above mechanism is not working.
openapi-generator version
5.0.0
OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
I could not find anything in open issues.
Suggest a fix/enhancement
I would suggest revisiting the list of reserved words for PowerShell and for reserved words that are generated as parameters to Advanced functions and can be parameters without the Var prefix, to be generated without adding the prefix. As a first step, all reserved words which could be generated without the prefix should be identified and then an additional check can be added to the escapeReservedWord(). I'd be happy to contribute the fix if it's approved.