You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since PowerShell 7.4, it seems that the Test-Json function cannot validate schemas based on draft-04
Within our DTL private repo, we have a set of tests for validating the artifact.json files on each Pull Request. One such test uses Test-Json to validate that the artifact.json file matches the schema to ensure that we don't commit any bad artifact files to the main branch
However, now that we are on PowerShell 7.4, this particular test is failing, because PowerShell can't seem to validate draft-04.
Is anybody aware if there is a newer dtlArtifacts schema based on draft-06 that we can use instead ? Or if there's any plans to update the current 2016-11-28 schema to draft-06 ?
Below is some code to demonstrate the issue
$ArtifactFile="https://raw.githubusercontent.com/Azure/azure-devtestlab/master/Artifacts/windows-fiddler/Artifactfile.json"$JsonContent=Invoke-WebRequest-Uri $ArtifactFile-Authentication None -Method Get |Select-Object-ExpandProperty Content
$JsonObject=ConvertFrom-Json-InputObject $JsonContent$SchemaURL=$JsonObject|Select-Object-ExpandProperty `$schema
$SchemaContent=Invoke-WebRequest-Uri $SchemaURL-Authentication None -Method Get |Select-Object-ExpandProperty Content
# the below produces error "Test-Json: Cannot parse the JSON schema."Test-Json-Json $JsonContent-Schema $SchemaContent# after doing a fine/replace on the schema to switch to draft-06, the validation works fine$SchemaContent=$SchemaContent.Replace("draft-04","draft-06")
Test-Json-Json $JsonContent-Schema $SchemaContent
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: