Skip to content

Commit

Permalink
Fix tests for NJsonSchema 11 (#19) (#2291)
Browse files Browse the repository at this point in the history
  • Loading branch information
rayokota authored Aug 26, 2024
1 parent ef89a01 commit bebc802
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageReference Include="NJsonSchema.NewtonsoftJson" Version="11.0.1" />
<PackageReference Include="NJsonSchema.NewtonsoftJson" Version="11.0.2" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' != 'net8.0' ">
Expand Down
7 changes: 6 additions & 1 deletion src/Confluent.SchemaRegistry.Serdes.Json/JsonSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,13 @@ public JsonSerializer(ISchemaRegistryClient schemaRegistryClient, JsonSerializer
this.jsonSchemaGeneratorSettings = jsonSchemaGeneratorSettings;

this.schema = this.jsonSchemaGeneratorSettings == null
#if NET8_0_OR_GREATER
? NewtonsoftJsonSchemaGenerator.FromType<T>()
: NewtonsoftJsonSchemaGenerator.FromType<T>(this.jsonSchemaGeneratorSettings);
#else
? JsonSchema.FromType<T>()
: JsonSchema.FromType<T>(this.jsonSchemaGeneratorSettings);
#endif
this.schemaText = schema.ToJson();
this.schemaFullname = schema.Title;

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

0 comments on commit bebc802

Please sign in to comment.