GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Require -FetchExternalReference to resolve external Test-Json schema references by jshigetomi · Pull Request #28205 · PowerShell/PowerShell

Conversation

@jshigetomi

@jshigetomi Justin Chung (jshigetomi) commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

PR Summary

This pull request enhances the Test-Json cmdlet by adding support for resolving external references in JSON schemas, controlled by a new -FetchExternalReference parameter. It also improves error handling and test coverage for various schema reference scenarios.

PR Context

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Make sure all .h, .cpp, .cs, .ps1 and .psm1 files have the correct copyright header
  • This PR is ready to merge. If this PR is a work in progress, please open this as a Draft Pull Request and mark it as Ready to Review when it is ready to merge.
  • Breaking changes
    • None
    • OR
    • Experimental feature(s) needed
      • Experimental feature name(s):
  • User-facing changes
    • Not Applicable
    • OR
    • Documentation needed
      • Issue filed:
  • Testing - New and feature
    • N/A or can only be tested interactively
    • OR
    • Make sure you've added a new test if existing tests do not effectively test the code changed

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Anam Navied Justin Chung
Disable fetch delegate on $ref feature so external references are not…
f6a93f4
… allowed in Test-Json schema (#201)
@jshigetomi Justin Chung (jshigetomi) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Oct 14, 2026
@azure-pipelines

azure-pipelines Bot commented Oct 14, 2026

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jshigetomi Justin Chung (jshigetomi) changed the title Disable fetch delegate on $ref feature so external references are not allowed in Test-Json schema Require -FetchExternalReference to resolve external Test-Json schema references Oct 14, 2026
@jshigetomi
Merge branch 'master' into 128628
36d6a2f
@jshigetomi
Justin Chung (jshigetomi) marked this pull request as ready for review October 14, 2026 21:42
@jshigetomi
Justin Chung (jshigetomi) requested a review from a team as a code owner October 14, 2026 21:42
Copilot AI balanced review requested due to automatic review settings October 14, 2026 21:42
Copilot started reviewing on behalf of Justin Chung (jshigetomi) October 14, 2026 21:44
View session
Copilot AI reviewed Oct 14, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new CI test depends on uncontrolled public HTTP traffic and can stall on restricted agents.

1 open finding
  • Medium severity Use a controlled loopback fixture instead of public HTTP in the test · New
What changed in this PR

Makes external schema fetching opt-in for Test-Json through -FetchExternalReference.

Changes:

  • Uses per-invocation schema evaluation options.
  • Adds unresolved-reference diagnostics.
  • Expands tests for internal, external, and invalid schema references.
File Description
test/​powershell/​Modules/​Microsoft.PowerShell.Utility/​Test-Json.Tests.ps1 Tests opt-in fetching and invocation isolation.
test/​powershell/​Modules/​Microsoft.PowerShell.Utility/​assets/​valid_schema.json Adds a standalone valid schema.
test/​powershell/​Modules/​Microsoft.PowerShell.Utility/​assets/​valid_schema_uri_references_external.json Adds an external HTTP reference.
test/​powershell/​Modules/​Microsoft.PowerShell.Utility/​assets/​valid_schema_references_internal.json Adds internal reference coverage.
test/​powershell/​Modules/​Microsoft.PowerShell.Utility/​assets/​valid_schema_references_external.json Adds external file references.
test/​powershell/​Modules/​Microsoft.PowerShell.Utility/​assets/​valid_schema_definitions_external.json Supplies externally referenced definitions.
test/​powershell/​Modules/​Microsoft.PowerShell.Utility/​assets/​invalid_schema.json Provides an independently invalid schema.
src/​Microsoft.PowerShell.Commands.Utility/​resources/​TestJsonCmdletStrings.resx Adds unresolved-reference guidance.
src/​Microsoft.PowerShell.Commands.Utility/​commands/​utility/​TestJsonCommand.cs Gates fetching and handles unresolved references.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread test/powershell/Modules/Microsoft.PowerShell.Utility/Test-Json.Tests.ps1
}

It "Json is valid but unresolvable, with FetchExternalReference parameter, against a schema with external URI reference" {
Test-Json -Json $validJson -SchemaFile $validSchemaWithExternalUriRefJsonPath -FetchExternalReference -ErrorVariable ErrorVar -ErrorAction SilentlyContinue | Should -BeFalse
@iSazonov Ilya (iSazonov) mentioned this pull request Oct 15, 2026
Disable fetch delegate on $ref feature so external references are not allowed in Test-Json schema #28214
Closed
12 tasks
@UncleBats Erick Segaar (UncleBats) mentioned this pull request Oct 15, 2026
Test-Json in 7.6.7 writes no error for violations nested below the first level (e.g. array items) #28218
Closed
5 tasks done
@daxian-dbw

Dongbo Wang (daxian-dbw) commented Oct 16, 2026

Copy link
Copy Markdown
Member

Anam Navied (@anamnavi) Please take a look at #28218 when reviewing this PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

adityapatwardhan
Aditya Patwardhan (adityapatwardhan) approved these changes Oct 19, 2026
View reviewed changes
@jshigetomi
Justin Chung (jshigetomi) merged commit 08db341 into master Oct 19, 2026
36 of 37 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@Agger1995 Agger (Agger1995) mentioned this pull request Oct 21, 2026
Test-Json fails with UnresolvedJsonSchemaRef when "$schema" is http://json-schema.org/schema (regression in 7.6.7, 7.5.12, 7.4.21) #28245
Closed
5 tasks done
@gecompat Gerhard P (gecompat) mentioned this pull request Oct 25, 2026
Complete owned test resource and temporary evidence cleanup gecompat/SQL_Server_Lab#841
Merged
@BillyONeal Billy O'Neal (BillyONeal) mentioned this pull request Oct 26, 2026
Test-Json: -FetchExternalReference microsoft/vcpkg-tool#2164
Merged
Billy O'Neal (BillyONeal) added a commit to microsoft/vcpkg-tool that referenced this pull request Oct 26, 2026
@BillyONeal
Test-Json: -FetchExternalReference (#2164)
70c7aa2
Fixes JSON schema failures in several recent PRs. This was broken by
recent pwsh, possibly from
PowerShell/PowerShell#28205 .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@adityapatwardhan Aditya Patwardhan (adityapatwardhan) adityapatwardhan approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@jshigetomi @daxian-dbw @adityapatwardhan
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.