Skip to content

Handle null metadata hashtable #60

@BernieWhite

Description

@BernieWhite

Describe the bug

When using the Metadata keyword`, the value passed may be null. When null is passed an exception is raised.

To Reproduce

Steps to reproduce the behaviour.

Document 'Example' {
    Metadata $Null
}

Expected behaviour

Metadata should gracefully handle null data by not adding any metadata and supressing the exception by default.

Error output

Invoke-PSDocument : Cannot bind argument to parameter 'Body' because it is null.
At line:1 char:18
+ ... s.Info | %{ Invoke-PSDocument -Path .\RuleHelp.Doc.ps1 -OutputPath .\ ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Write-Error], InvokeDocumentException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Metadata,Invoke-PSDocument

Module in use and version:

  • Module: PSDocs
  • Version 0.6.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions