Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Test-Json fails to parse schema while other validators succeed #9560

Copy link
Copy link
@chriskuech

Description

@chriskuech
Issue body actions

Steps to reproduce

good.params.json

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
  "contentVersion": "0.0.0.1",
  "parameters": {
    "var1": {
      "value": "4"
    },
    "var2": {
      "reference": {
        "keyVault": {
          "id": "<keyvault-resource-id>"
        },
        "secretName": "<secret-name>"
      }
    }
  }
}
$json = Get-Content $PSScriptRoot\good.params.json -Raw
$schemaUri = ($json | ConvertFrom-Json).'$schema' -replace "#.*"
[string]$schema = Invoke-WebRequest $schemaUri
Test-Json -Json $json -Schema $schema

Expected behavior

I have tested the schema and json in two online validators and neither had issues, so I would expect Test-Json to not throw an error.

Actual behavior

Test-Json : Cannot parse the JSON schema.
At /bugrepro.ps1:4 char:1
+ Test-Json -Json $json -Schema $schema
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidData: (:) [Test-Json], Exception
+ FullyQualifiedErrorId : InvalidJsonSchema,Microsoft.PowerShell.Commands.TestJsonCommand

Environment data

Name                           Value
----                           -----
PSVersion                      6.2.0
PSEdition                      Core
GitCommitId                    6.2.0
OS                             Darwin 18.5.0 Darwin Kernel Version 18.5.…
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-ExternalThe issue is caused by external component(s).The issue is caused by external component(s).

    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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.