=== Summary: 675 files | 7 generated | 484 fresh | 4605 untracked | 4268 adopted | 355 marked | 466 validated-ok | 2+0 stale (sig+body) | 0 skipped | 0 failed | elapsed 11:08:11.442 (40091.44s) ===
This commit is contained in:
@@ -9,6 +9,7 @@ namespace adas_core.Domain.Utils;
|
||||
/// <remarks>
|
||||
/// Inherits from <see cref="JsonConverter"/> to customize JSON representation for the type it targets.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=f98482b -->
|
||||
public class ObjectIdConverter : JsonConverter
|
||||
{
|
||||
/// <summary>
|
||||
@@ -17,6 +18,7 @@ public class ObjectIdConverter : JsonConverter
|
||||
/// <param name="writer">The <see cref="JsonWriter"/> used to emit the JSON output.</param>
|
||||
/// <param name="value">The value to serialize, expected to be an <see cref="ObjectId"/> instance.</param>
|
||||
/// <param name="serializer">The <see cref="JsonSerializer"/> invoking this converter.</param>
|
||||
/// <!-- aidoc:v1 sig=0bafa81 body=beff169 -->
|
||||
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
|
||||
{
|
||||
if (value is ObjectId objectId)
|
||||
@@ -34,6 +36,7 @@ public class ObjectIdConverter : JsonConverter
|
||||
/// <param name="existingValue">The existing value being populated, passed through from the deserializer.</param>
|
||||
/// <param name="serializer">The JSON serializer invoking this converter.</param>
|
||||
/// <returns>An <see cref="ObjectId"/> instance when the value can be parsed or when the target type is non-nullable; <c>null</c> when the target type is nullable and no valid value is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=881b805 body=5a6faf1 -->
|
||||
public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue,
|
||||
JsonSerializer serializer)
|
||||
{
|
||||
@@ -59,6 +62,10 @@ public class ObjectIdConverter : JsonConverter
|
||||
/// </summary>
|
||||
/// <param name="objectType">The type to evaluate for compatibility with the converter.</param>
|
||||
/// <returns><see langword="true"/> if <paramref name="objectType"/> can be assigned from <see cref="ObjectId"/>; otherwise, <see langword="false"/>.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_returns
|
||||
/// "The code `typeof(ObjectId).IsAssignableFrom(objectType)` returns true when objectType is assignable TO ObjectId (i.e., objectType is ObjectId or a derived type). The doc states the opposite: 'objectType can be assigned from ObjectId' would mean ObjectId is assignable to objectType." -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "Summary says 'checking if the type is assignable from ObjectId', which implies ObjectId is assignable to the type. The code actually checks if the type is assignable to ObjectId." -->
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
return typeof(ObjectId).IsAssignableFrom(objectType);
|
||||
|
||||
Reference in New Issue
Block a user