Skip to content

Commit bebc802

Browse files
authored
Fix tests for NJsonSchema 11 (#19) (#2291)
1 parent ef89a01 commit bebc802

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/Confluent.SchemaRegistry.Serdes.Json/Confluent.SchemaRegistry.Serdes.Json.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</PropertyGroup>
2525

2626
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
27-
<PackageReference Include="NJsonSchema.NewtonsoftJson" Version="11.0.1" />
27+
<PackageReference Include="NJsonSchema.NewtonsoftJson" Version="11.0.2" />
2828
</ItemGroup>
2929

3030
<ItemGroup Condition=" '$(TargetFramework)' != 'net8.0' ">

src/Confluent.SchemaRegistry.Serdes.Json/JsonSerializer.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,13 @@ public JsonSerializer(ISchemaRegistryClient schemaRegistryClient, JsonSerializer
100100
this.jsonSchemaGeneratorSettings = jsonSchemaGeneratorSettings;
101101

102102
this.schema = this.jsonSchemaGeneratorSettings == null
103+
#if NET8_0_OR_GREATER
104+
? NewtonsoftJsonSchemaGenerator.FromType<T>()
105+
: NewtonsoftJsonSchemaGenerator.FromType<T>(this.jsonSchemaGeneratorSettings);
106+
#else
103107
? JsonSchema.FromType<T>()
104108
: JsonSchema.FromType<T>(this.jsonSchemaGeneratorSettings);
109+
#endif
105110
this.schemaText = schema.ToJson();
106111
this.schemaFullname = schema.Title;
107112

@@ -185,7 +190,7 @@ public JsonSerializer(ISchemaRegistryClient schemaRegistryClient, Schema schema,
185190
/// Context relevant to the serialize operation.
186191
/// </param>
187192
/// <returns>
188-
/// A <see cref="System.Threading.Tasks.Task" /> that completes with
193+
/// A <see cref="System.Threading.Tasks.Task" /> that completes with
189194
/// <paramref name="value" /> serialized as a byte array.
190195
/// </returns>
191196
public override async Task<byte[]> SerializeAsync(T value, SerializationContext context)

0 commit comments

Comments
 (0)