-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Labels
Description
Problem
Currently, in several PowerShell functions, the variable name $inputObject
is used to represent a hashtable containing parameters for API requests. However, $inputObject
typically implies pipeline input rather than API request parameters, making it confusing and misleading for developers maintaining the code.
Example of confusing usage:
$inputObject = @{
Method = 'DELETE'
APIEndpoint = "/orgs/$Name"
Context = $Context
}
Invoke-GitHubAPI @inputObject
Proposed Solution
Rename all occurrences of $inputObject
used specifically for API request parameter hashtables to $apiParams
for clarity and better readability.
After rename, the above code should look like:
$apiParams = @{
Method = 'DELETE'
APIEndpoint = "/orgs/$Name"
Context = $Context
}
Invoke-GitHubAPI @apiParams
Scope of Change
- Change: All occurrences where
$inputObject
explicitly represents parameters passed toInvoke-GitHubAPI
. - Do Not Change: Parameters named
$InputObject
intended for pipeline input objects (such as[Parameter(ValueFromPipeline)]
).
Implementation
- Find and review all scripts/functions that call
Invoke-GitHubAPI
. - Rename relevant
$inputObject
occurrences to$apiParams
. - Ensure all unit tests pass after changes to confirm no unintended side effects.
Outcome
Improved code clarity and maintainability, reducing potential confusion for future development and maintenance.
Copilot
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done