PowerShell / PowerShell/PSResourceGet

Update-ModuleManifest parameter surface should mirror New-ModuleManifest

Open
#1,740 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-InfoFile feature_request Up-For-Grabs
Dominant language
C#
Stars
576
Forks
114
Avg merge
1d 2h
Merged PRs (30d)
7

Description

Summary of the new feature / enhancement

The current implementation of Update-ModuleManifest does not accept empty arguments for a number of parameters, meaning it can't be used to clear array-like values from existing manifests:

Update-ModuleManifest .\Test\Test.psd1 -RequiredModules @()

Instead of updating the manifest with RequiredModules = @(), this actually throws a validation error because -RequiredModules doesn't accept empty arguments.

This issue was initially raised here.

Proposed technical implementation details (optional)

Update the cmdlet in src/code/UpdateModuleManifest.cs.

Parameters that should be decorated with [AllowEmptyCollection]:

  • NestedModules
  • TypesToProcess
  • FormatsToProcess
  • ScriptsToProcess
  • RequiredAssemblies
  • FileList
  • ModuleList
  • FunctionsToExport
  • AliasesToExport
  • VariablesToExport
  • CmdletsToExport
  • DscResourcesToExport
  • CompatiblePSEditions

There's a number of additional parameters for which [AllowNull]/[AllowEmptyString] might be appropriate too.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/code/UpdateModuleManifest.cs and compare the Update-ModuleManifest parameter declarations with the intended New-ModuleManifest surface. Apply the requested empty-collection handling to the listed array-like parameters and confirm that commands such as Update-ModuleManifest .\Test\Test.psd1 -RequiredModules @() can clear existing values without a validation error.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.