Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #8805
Closed
Open
Issue created Feb 23, 2021 by Administrator@rootContributor

[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.

Assignee
Assign to
Time tracking