Azure / azure-devtestlab

Azure DevTestLab artifacts, scripts and samples
MIT License
458 stars 602 forks source link

DTL Artifact JSON Schema for draft-06 ?? #888

Open mmcdermo2 opened 6 months ago

mmcdermo2 commented 6 months ago
$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