PowerShell / platyPS

Write PowerShell External Help in Markdown
MIT License
762 stars 148 forks source link

After updating version of platyPS (from ) creating new external help file is throwing error #648

Closed Man2MSFT closed 1 month ago

Man2MSFT commented 1 month ago

Prerequisites

Steps to reproduce

trying command

new-externalhelp D:\Powershelltesting\office-docs-powershell\teams\teams-ps\teams\Get-CsTenant.md

Expected behavior

it should passed without any error.
We are using it in public documentation for the cmdlet as well - https://learn.microsoft.com/en-us/powershell/module/teams/get-cstenant?view=teams-ps

Actual behavior

PS D:\Powershelltesting> new-externalhelp D:\Powershelltesting\office-docs-powershell\teams\teams-ps\teams\Get-CsTenant.md
cmdlet New-ExternalHelp at command pipeline position 1
Supply values for the following parameters:
OutputPath: .
Exception calling "NodeModelToMamlModel" with "1" argument(s): "D:\Powershelltesting\office-docs-powershell\teams\teams-ps\teams\Get-CsTenant.md:96:(111) '
Type: Fqdn
Parameter Sets: (All)
Aliase...'
 Invalid yaml: unknown key applicable"
At C:\Users\manojkumar\Documents\WindowsPowerShell\Modules\platyps\0.7.6\platyPS.psm1:1224 char:9
+         $maml = $t.NodeModelToMamlModel($model)
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : HelpSchemaException

SetOnlineVersionUrlLink : Cannot bind argument to parameter 'MamlCommandObject' because it is null.
At C:\Users\manojkumar\Documents\WindowsPowerShell\Modules\platyps\0.7.6\platyPS.psm1:1231 char:60
+                 SetOnlineVersionUrlLink -MamlCommandObject $_ -Online ...
+                                                            ~~
    + CategoryInfo          : InvalidData: (:) [SetOnlineVersionUrlLink], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,SetOnlineVersionUrlLink

Exception calling "MamlModelToString" with "2" argument(s): "Object reference not set to an instance of an object."
At C:\Users\manojkumar\Documents\WindowsPowerShell\Modules\platyps\0.7.6\platyPS.psm1:685 char:13
+             $xml = $r.MamlModelToString($maml, $false) # skipPreambul ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NullReferenceException

MySetContent : Cannot bind argument to parameter 'value' because it is an empty string.
At C:\Users\manojkumar\Documents\WindowsPowerShell\Modules\platyps\0.7.6\platyPS.psm1:688 char:48
+             MySetContent -Path $outPath -Value $xml -Encoding $Encodi ...
+                                                ~~~~
    + CategoryInfo          : InvalidData: (:) [MySetContent], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,MySetContent

Error details

In our build pipeline we are using it, as given below

Install-Module -Name PlatyPS -AllowClobber -Confirm:$False -Force -Scope CurrentUser -SkipPublisherCheck

While using it threw given error

PlatyPS schema version 1.0.0 is deprecated and not supported anymore. Please install platyPS 0.7.6 and migrate to the 
supported version.
At C:\Users\cloudtest\Documents\WindowsPowerShell\Modules\platyPS\0.14.2\platyPS.psm1:1644 char:9
+         throw $LocalizedData.PlatyPS100SchemaDeprecated
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (PlatyPS schema ...ported version.:String) [], RuntimeException
    + FullyQualifiedErrorId : PlatyPS schema version 1.0.0 is deprecated and not supported anymore. Please install pla 
   tyPS 0.7.6 and migrate to the supported version.

So we update our installing command like
Install-Module -Name PlatyPS -AllowClobber -Confirm:$False -Force -Scope CurrentUser -SkipPublisherCheck -RequiredVersion 0.7.6
import-module platyps -RequiredVersion 0.7.6

Environment data

Get-module -Name platyPS
ModuleType Version    Name                                ExportedCommands                                                                                                                                  
---------- -------    ----                                ----------------                                                                                                                                  
Script     0.7.6      platyps                             {Get-HelpPreview, Get-MarkdownMetadata, New-ExternalHelp, New-ExternalHelpCab...}

$PSversiontable

Name                           Value                                                                                                                                                                        
----                           -----                                                                                                                                                                        
PSVersion                      5.1.22621.3672                                                                                                                                                               
PSEdition                      Desktop                                                                                                                                                                      
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                      
BuildVersion                   10.0.22621.3672                                                                                                                                                              
CLRVersion                     4.0.30319.42000                                                                                                                                                              
WSManStackVersion              3.0                                                                                                                                                                          
PSRemotingProtocolVersion      2.3                                                                                                                                                                          
SerializationVersion           1.1.0.1

Visuals

No response