Skip to content

Commit d8e1970

Browse files
thisisnotarobotadityapatwardhan
authored andcommitted
Modified GetSchemaVersion function to assume 2.0.0 if no schema version found (#452)
1 parent c1e0030 commit d8e1970

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

src/platyPS/platyPS.psm1

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,17 +1619,13 @@ function GetSchemaVersion
16191619
if ($metadata)
16201620
{
16211621
$schema = $metadata[$script:SCHEMA_VERSION_YAML_HEADER]
1622-
if (-not $schema)
1623-
{
1624-
# there is metadata, but schema version is not specified.
1625-
# assume 2.0.0
1626-
$schema = '2.0.0'
1627-
}
16281622
}
1629-
else
1623+
1624+
if (-not $schema)
16301625
{
1631-
# if there is not metadata, then it's schema version 1.0.0
1632-
$schema = '1.0.0'
1626+
# either there is no metadata, or schema version is not specified.
1627+
# assume 2.0.0
1628+
$schema = '2.0.0'
16331629
}
16341630

16351631
return $schema

test/Pester/PlatyPs.Tests.ps1

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -682,13 +682,6 @@ Describe 'New-ExternalHelp -ErrorLogFile' {
682682
It "generates error log file" {
683683
Test-Path "$TestDrive\warningsAndErrors.json" | Should Be $true
684684
}
685-
686-
It "error log file is valid JSON" {
687-
$r = (Get-Content "$TestDrive\warningsAndErrors.json" | ConvertFrom-Json)
688-
$r[0].Message | Should Be "PlatyPS schema version 1.0.0 is deprecated and not supported anymore. Please install platyPS 0.7.6 and migrate to the supported version..Exception.Message"
689-
$r[0].Severity | Should Be "Error"
690-
$r[0].FilePath | Should Be ""
691-
}
692685
}
693686

694687
Describe 'New-ExternalHelp -ApplicableTag for cmdlet level' {

0 commit comments

Comments
 (0)