Repository navigation
Require -FetchExternalReference to resolve external Test-Json schema references - #28205
Open
Justin Chung (jshigetomi) wants to merge 2 commits into
Open
Justin Chung (jshigetomi) wants to merge 2 commits into
Justin Chung (jshigetomi) wants to merge 2 commits into
Conversation
… allowed in Test-Json schema (#201)
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new CI test depends on uncontrolled public HTTP traffic and can stall on restricted agents.
1 open finding
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.
| } | ||
|
|
||
| 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 |
12 tasks
5 tasks done
Member
|
Anam Navied (@anamnavi) Please take a look at #28218 when reviewing this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

PR Summary
This pull request enhances the
Test-Jsoncmdlet by adding support for resolving external references in JSON schemas, controlled by a new-FetchExternalReferenceparameter. It also improves error handling and test coverage for various schema reference scenarios.PR Context
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header