Skip to content

Cannot parse the JSON schema #64

Closed
@easitab-owner

Description

@easitab-owner

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

PowerShell/PowerShell#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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions