Skip to content

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

@mmcdermo2

Description

@mmcdermo2
  • The current schema for Artifacts (https://raw.githubusercontent.com/Azure/azure-devtestlab/master/schemas/2016-11-28/dtlArtifacts.json) is based on JSON schema draft-04.
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions