supporting: Update Newtonsoft.Json to 11.0.2, Newtonsoft.Json.Schema to 3.0.10 (#3043)

- Update supporting\validator\bin\Newtonsoft.Json to 11.0.2
  - **HIGHLIGHT**: support for regex operator in JSON Paths
  - Latest Newtonsoft.Json version is 12.0.1, which has some compatibility issues with Json.Schema 3.0.10 and PowerShell Core 6.1.12 (On my PC)
- Update supporting\validator\bin\Newtonsoft.Json.Schema to 3.0.10
- Use .NET 4.5 instead of .NET 4.0, since Scoop's requirements is [.NET Framework 4.5+](https://github.com/lukesampson/scoop#requirements)
- Modify `json_path()` to escape `$version` substitutions when `$jsonpath` has regex

**EXAMPLE OF JPATH REGEX**
```json
"checkver": {
    "url": "https://dist.nuget.org/index.json",
    "jp": "$..versions[?(@.displayName =~ /.*recommended.*/)].version"
}
```
This commit is contained in:
Hsiao-nan Cheung
2019-02-17 05:20:37 +08:00
committed by Richard Kuhnt
parent 28f74572a6
commit 03ebcc2984
11 changed files with 23 additions and 27 deletions

View File

@@ -95,7 +95,7 @@ function ConvertToPrettyJson {
function json_path([String] $json, [String] $jsonpath, [Hashtable] $substitutions) {
Add-Type -Path "$psscriptroot\..\supporting\validator\bin\Newtonsoft.Json.dll"
if ($null -ne $substitutions) {
$jsonpath = substitute $jsonpath $substitutions
$jsonpath = substitute $jsonpath $substitutions ($jsonpath -like "*=~*")
}
try {
$obj = [Newtonsoft.Json.Linq.JObject]::Parse($json)