Title: `Test-Json` fails with UnresolvedJsonSchemaRef when "$schema" is http://json-schema.org/schema (regression in 7.6.7, 7.5.12, 7.4.21) · Issue #28245 · PowerShell/PowerShell · GitHub
Open Graph Title: `Test-Json` fails with UnresolvedJsonSchemaRef when "$schema" is http://json-schema.org/schema (regression in 7.6.7, 7.5.12, 7.4.21) · Issue #28245 · PowerShell/PowerShell
X Title: `Test-Json` fails with UnresolvedJsonSchemaRef when "$schema" is http://json-schema.org/schema (regression in 7.6.7, 7.5.12, 7.4.21) · Issue #28245 · PowerShell/PowerShell
Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerShell 5.1 and PowerShell. Steps to reprodu...
Open Graph Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
X Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/28245
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`Test-Json` fails with UnresolvedJsonSchemaRef when \"$schema\" is http://json-schema.org/schema (regression in 7.6.7, 7.5.12, 7.4.21)","articleBody":"### Prerequisites\n\n- [x] Write a descriptive title.\n- [x] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\n- [x] Search the existing issues.\n- [x] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\n- [x] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://learn.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\n\n### Steps to reproduce\n\nSince 7.6.7, 7.5.12 and 7.4.21, `Test-Json` can't use a schema whose `$schema` keyword is `http://json-schema.org/schema`. It writes `UnresolvedJsonSchemaRef` and returns `False` for any input, valid or not. With `-ErrorAction SilentlyContinue`, that `False` comes back with no output at all. Up to 7.6.6, 7.5.11 and 7.4.20 it validated the input normally.\n\n```powershell\n# A concrete metaschema URI works in every version\nTest-Json -Json '{}' -Schema '{ \"$schema\": \"https://json-schema.org/draft/2020-12/schema\", \"type\": \"object\" }'\n\n# The http://json-schema.org/schema URI at the top level\nTest-Json -Json '{}' -Schema '{ \"$schema\": \"http://json-schema.org/schema\", \"type\": \"object\" }'\n\n# The same URI in a nested subschema, even though the input doesn't contain \"a\"\nTest-Json -Json '{}' -Schema '{ \"type\": \"object\", \"properties\": { \"a\": { \"$schema\": \"http://json-schema.org/schema\" } } }'\n```\n\n`-SchemaFile` behaves the same as `-Schema`.\n\nNotes:\n\n- The schemas contain no `$ref`. `Get-Error` shows the failure happens while resolving the `$schema` dialect (`Json.Schema.SchemaRegistry.SetDialect`), so the message about external references is misleading here.\n- Any `$schema` value other than the exact draft-06, draft-07, 2019-09 and 2020-12 metaschema URIs fails the same way. That includes common variants such as `https://json-schema.org/schema` and the http spelling of the 2020-12 URI, `http://json-schema.org/draft/2020-12/schema`. All of them work on 7.6.6.\n- Passing `-FetchExternalReference` restores the old result (last command under \"Actual behavior\"), because the metaschema is then downloaded again. Earlier versions apparently did that download implicitly.\n- None of the release notes for v7.6.7, v7.5.12 and v7.4.21 mentions this change.\n\nCould any of these be considered?\n\n1. Make the error say that the `$schema` metaschema could not be resolved, rather than referring to external references.\n2. Mention the change as a breaking change in the release notes.\n3. Resolve the json-schema.org metaschema URIs, including `http://json-schema.org/schema`, without a network fetch.\n\nRelated: #28205 (and #28214, closed as its duplicate), and #28218 (a separate 7.6.7 `Test-Json` regression from the same servicing change).\n\n### Expected behavior\n\n```console\nPS> Test-Json -Json '{}' -Schema '{ \"$schema\": \"https://json-schema.org/draft/2020-12/schema\", \"type\": \"object\" }'\nTrue\nPS> Test-Json -Json '{}' -Schema '{ \"$schema\": \"http://json-schema.org/schema\", \"type\": \"object\" }'\nTrue\nPS> Test-Json -Json '{}' -Schema '{ \"type\": \"object\", \"properties\": { \"a\": { \"$schema\": \"http://json-schema.org/schema\" } } }'\nTrue\n```\n\n### Actual behavior\n\n```console\nPS> Test-Json -Json '{}' -Schema '{ \"$schema\": \"https://json-schema.org/draft/2020-12/schema\", \"type\": \"object\" }'\nTrue\nPS> Test-Json -Json '{}' -Schema '{ \"$schema\": \"http://json-schema.org/schema\", \"type\": \"object\" }'\nTest-Json: The JSON schema contains a reference that could not be resolved. External schema references are not supported by default, use the 'FetchExternalReference' parameter to enable it.\nFalse\nPS> Test-Json -Json '{}' -Schema '{ \"type\": \"object\", \"properties\": { \"a\": { \"$schema\": \"http://json-schema.org/schema\" } } }'\nTest-Json: The JSON schema contains a reference that could not be resolved. External schema references are not supported by default, use the 'FetchExternalReference' parameter to enable it.\nFalse\nPS> Test-Json -Json '{}' -Schema '{ \"$schema\": \"http://json-schema.org/schema\", \"type\": \"object\" }' -FetchExternalReference\nTrue\n```\n\n### Error details\n\n```console\nPS> Get-Error\n\nException :\n Type : System.Exception\n Message : The JSON schema contains a reference that could not be resolved. External schema references are not supported by default, use the 'FetchExternalReference' parameter to enable it.\n InnerException :\n Type : Json.Schema.RefResolutionException\n BaseUri : http://json-schema.org/schema\n TargetSite :\n Name : SetDialect\n DeclaringType : [Json.Schema.SchemaRegistry]\n MemberType : Method\n Module : JsonSchema.Net.dll\n Message : Could not resolve 'http://json-schema.org/schema'\n Source : JsonSchema.Net\n HResult : -2146233088\n StackTrace :\n at Json.Schema.SchemaRegistry.SetDialect(JsonSchema schema, Vocabulary[] parentDialect)\n at Json.Schema.SchemaRegistry.Scan(Uri baseUri, JsonSchema document)\n at Json.Schema.SchemaRegistry.RegisterSchema(Uri uri, IBaseDocument document)\n at Json.Schema.JsonSchema.Evaluate(JsonNode root, EvaluationOptions options)\n at Microsoft.PowerShell.Commands.TestJsonCommand.ProcessRecord()\n HResult : -2146233088\nTargetObject : Json.Schema.JsonSchema\nCategoryInfo : InvalidData: (Json.Schema.JsonSchema:JsonSchema) [Test-Json], Exception\nFullyQualifiedErrorId : UnresolvedJsonSchemaRef,Microsoft.PowerShell.Commands.TestJsonCommand\nInvocationInfo :\n MyCommand : Test-Json\n ScriptLineNumber : 1\n OffsetInLine : 1\n HistoryId : 1\n Line : Test-Json -Json '{}' -Schema '{ \"$schema\": \"http://json-schema.org/schema\", \"type\": \"object\" }'\n Statement : Test-Json -Json '{}' -Schema '{ \"$schema\": \"http://json-schema.org/schema\", \"type\": \"object\" }'\n PositionMessage : At line:1 char:1\n + Test-Json -Json '{}' -Schema '{ \"$schema\": \"http://json-schema.org/sc …\n + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n InvocationName : Test-Json\n CommandOrigin : Internal\nScriptStackTrace : at \u003cScriptBlock>, \u003cNo file>: line 1\nPipelineIterationInfo :\n 0\n 1\n```\n\n### Environment data\n\n```powershell\nName Value\n---- -----\nPSVersion 7.6.7\nPSEdition Core\nGitCommitId 7.6.7\nOS Ubuntu 24.04.2 LTS\nPlatform Unix\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\nPSRemotingProtocolVersion 2.4\nSerializationVersion 1.1.0.1\nWSManStackVersion 3.0\n```\n\n### Visuals\n\n_No response_","author":{"url":"https://github.com/Agger1995","@type":"Person","name":"Agger1995"},"datePublished":"2026-10-21T08:58:25Z","url":"https://github.com/PowerShell/PowerShell/issues/28245"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b9d53d2f-72be-3c04-4ef7-4fe3942b89d0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D8AE:3B1EC4:45F80D:5C94D2:6AFCEA7A |
| html-safe-nonce | 411da5f10d03b3393b19fd2f72d7173b63cc4af2d0c2fcd4c916664cf0db009d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOEFFOjNCMUVDNDo0NUY4MEQ6NUM5NEQyOjZBRkNFQTdBIiwidmlzaXRvcl9pZCI6Ijc1NzA0NzU2NjMxNTMyMjg0MTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a349c6ba8342043029725807794d1c7ce7783b98bdbeb599f7f350733cbab8fa |
| hovercard-subject-tag | issue:5957489029 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/28245/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0ee330bdc4163edf6d5bff98901e4846126e627e9f1f46e01ddf9a2ee37707f8/PowerShell/PowerShell/issues/28245 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0ee330bdc4163edf6d5bff98901e4846126e627e9f1f46e01ddf9a2ee37707f8/PowerShell/PowerShell/issues/28245 |
| og:image:alt | Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Agger1995 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 99aede4c5f55ec5cf06666a8c9e03ebf9f85f7231223e7f1c38c16e5504835b3 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ecfd63ca125ec74b42f74eeb158b3fa081c8c497 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width