easitab / EPR.GlobalFunctions

Provide functions to be used in script executed by EasitProcessRunner
https://docs.easitgo.com/techspace/epr/globalfunctions/
Apache License 2.0
1 stars 0 forks source link

Cannot parse the JSON schema #64

Open easitab-owner opened 4 months ago

easitab-owner commented 4 months ago

With the release of PowerShell 7.4 a breaking change was introduced, "Test-Json now uses JsonSchema.Net instead of Newtonsoft.Json.Schema. With this change, Test-Json no longer supports the older Draft 4 schemas.".

https://learn.microsoft.com/en-us/powershell/scripting/whats-new/what-s-new-in-powershell-74?view=powershell-7.4#breaking-changes

https://github.com/PowerShell/PowerShell/pull/18141

As 'installerSettings.schema.json' is generated with a Draft v4 this change causes 'New-EPRInstallation' to fail.

System.Exception: Cannot parse the JSON schema. ---> Microsoft.PowerShell.Commands.JsonSchemaReferenceResolutionException: Exception of type 'Microsoft.PowerShell.Commands.JsonSchemaReferenceResolutionException' was thrown. ---> System.Text.Json.JsonException: Expected number at Json.Schema.ExclusiveMinimumKeywordJsonConverter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) at Json.Schema.JsonSerializerOptionsExtensions.ArbitraryDeserializer1.Read(Utf8JsonReader& reader, JsonSerializerOptions options) at Json.Schema.SchemaJsonConverter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue) at System.Text.Json.Serialization.JsonDictionaryConverter3.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TDictionary& value) at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue) at System.Text.Json.Serialization.JsonResumableConverter1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) at Json.Schema.PropertiesKeywordJsonConverter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) at Json.Schema.JsonSerializerOptionsExtensions.ArbitraryDeserializer1.Read(Utf8JsonReader& reader, JsonSerializerOptions options) at Json.Schema.SchemaJsonConverter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue) at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 utf8Json, JsonTypeInfo1 jsonTypeInfo, Nullable1 actualByteCount) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 json, JsonTypeInfo1 jsonTypeInfo) at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options) at Microsoft.PowerShell.Commands.TestJsonCommand.<>c.b__30_0(Uri uri) --- End of inner exception stack trace --- at Microsoft.PowerShell.Commands.TestJsonCommand.<>c.b__30_0(Uri uri) at Json.Schema.SchemaRegistry.GetRegistration(Uri uri) at Json.Schema.JsonSchema.DetermineSpecVersion(JsonSchema schema, SchemaRegistry registry, SpecVersion desiredDraft) at Json.Schema.JsonSchema.Evaluate(JsonNode root, EvaluationOptions options) at Microsoft.PowerShell.Commands.TestJsonCommand.ProcessRecord() --- End of inner exception stack trace ---`

We need to generate a new schema with Draft v7 and update the installation package.

plingy commented 3 months ago

La in "$schema": "http://json-schema.org/draft-07/schema#", "title": "Generated schema for Root", Ovanför "type":"object", Detta löste problemet. Tack Anders!