Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#nullable enable

namespace LabelStudio.JsonConverters
{
/// <inheritdoc />
public sealed class StateSourceEnumJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::LabelStudio.StateSourceEnum>
{
/// <inheritdoc />
public override global::LabelStudio.StateSourceEnum Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
{
switch (reader.TokenType)
{
case global::System.Text.Json.JsonTokenType.String:
{
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::LabelStudio.StateSourceEnumExtensions.ToEnum(stringValue) ?? default;
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::LabelStudio.StateSourceEnum)numValue;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::LabelStudio.StateSourceEnum);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::LabelStudio.StateSourceEnum value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

writer.WriteStringValue(global::LabelStudio.StateSourceEnumExtensions.ToValueString(value));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#nullable enable

namespace LabelStudio.JsonConverters
{
/// <inheritdoc />
public sealed class StateSourceEnumNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::LabelStudio.StateSourceEnum?>
{
/// <inheritdoc />
public override global::LabelStudio.StateSourceEnum? Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
{
switch (reader.TokenType)
{
case global::System.Text.Json.JsonTokenType.String:
{
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::LabelStudio.StateSourceEnumExtensions.ToEnum(stringValue);
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::LabelStudio.StateSourceEnum)numValue;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::LabelStudio.StateSourceEnum?);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::LabelStudio.StateSourceEnum? value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

if (value == null)
{
writer.WriteNullValue();
}
else
{
writer.WriteStringValue(global::LabelStudio.StateSourceEnumExtensions.ToValueString(value.Value));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ namespace LabelStudio
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.ReviewSettings))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.ProjectSamplingEnum), TypeInfoPropertyName = "ProjectSamplingEnum2")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.SkipQueueEnum), TypeInfoPropertyName = "SkipQueueEnum2")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.StateSourceEnum), TypeInfoPropertyName = "StateSourceEnum2")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.AnalyticsView))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.DashboardTypeEnum), TypeInfoPropertyName = "DashboardTypeEnum2")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Guid))]
Expand Down Expand Up @@ -514,7 +515,6 @@ namespace LabelStudio
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.PatchedAzureServicePrincipalExportStorageRequest))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.PatchedAzureServicePrincipalImportStorageRequest))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.PatchedBlueprintUpdateRequest))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.PatchedCommentRequest))]
internal sealed partial class SourceGenerationContextChunk0 : global::System.Text.Json.Serialization.JsonSerializerContext
{
}
Expand All @@ -536,6 +536,7 @@ internal sealed partial class SourceGenerationContextChunk0 : global::System.Tex
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List<global::System.Collections.Generic.List<double?>>), TypeInfoPropertyName = "ListListDouble_System_Collections_Generic_List_global_System_Collections_Generic_List_double")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List<double?>), TypeInfoPropertyName = "ListDouble_System_Collections_Generic_List_double_3")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List<global::System.Collections.Generic.List<double>>), TypeInfoPropertyName = "ListListDouble_System_Collections_Generic_List_global_System_Collections_Generic_List_double_3")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.PatchedCommentRequest))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.PatchedCoursePageUpdateRequest))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.PatchedDatabricksExportStorageWriteRequest))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.PatchedDatabricksImportStorageWriteRequest))]
Expand Down Expand Up @@ -929,6 +930,7 @@ internal sealed partial class SourceGenerationContextChunk0 : global::System.Tex
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.AnnotatorEvaluationMetricEnum?), TypeInfoPropertyName = "NullableAnnotatorEvaluationMetricEnum2")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.ProjectSamplingEnum?), TypeInfoPropertyName = "NullableProjectSamplingEnum2")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.SkipQueueEnum?), TypeInfoPropertyName = "NullableSkipQueueEnum2")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.StateSourceEnum?), TypeInfoPropertyName = "NullableStateSourceEnum2")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.DashboardTypeEnum?), TypeInfoPropertyName = "NullableDashboardTypeEnum2")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Guid?))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(long?))]
Expand Down Expand Up @@ -1023,8 +1025,6 @@ internal sealed partial class SourceGenerationContextChunk0 : global::System.Tex
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.ApiProjectsAwsCustomFunctionRetrieveResponseStatus?), TypeInfoPropertyName = "NullableApiProjectsAwsCustomFunctionRetrieveResponseStatus2")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.ApiProjectsCustomFunctionRetrieveResponseStatus?), TypeInfoPropertyName = "NullableApiProjectsCustomFunctionRetrieveResponseStatus2")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.ApiProjectsGcpCustomFunctionRetrieveResponseStatus?), TypeInfoPropertyName = "NullableApiProjectsGcpCustomFunctionRetrieveResponseStatus2")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.OneOf<global::System.Collections.Generic.IList<global::System.Collections.Generic.IList<double>>, global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IList<global::System.Collections.Generic.IList<double>>>>?), TypeInfoPropertyName = "NullableOneOfIListIListDoubleDictionaryStringIListIListDouble2")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.OneOf<double?, global::System.Collections.Generic.Dictionary<string, double>>?), TypeInfoPropertyName = "NullableOneOfDoubleDictionaryStringDouble2")]
internal sealed partial class SourceGenerationContextChunk1 : global::System.Text.Json.Serialization.JsonSerializerContext
{
}
Expand All @@ -1046,6 +1046,8 @@ internal sealed partial class SourceGenerationContextChunk1 : global::System.Tex
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List<global::System.Collections.Generic.List<double?>>), TypeInfoPropertyName = "ListListDouble_System_Collections_Generic_List_global_System_Collections_Generic_List_double")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List<double?>), TypeInfoPropertyName = "ListDouble_System_Collections_Generic_List_double_3")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List<global::System.Collections.Generic.List<double>>), TypeInfoPropertyName = "ListListDouble_System_Collections_Generic_List_global_System_Collections_Generic_List_double_3")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.OneOf<global::System.Collections.Generic.IList<global::System.Collections.Generic.IList<double>>, global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IList<global::System.Collections.Generic.IList<double>>>>?), TypeInfoPropertyName = "NullableOneOfIListIListDoubleDictionaryStringIListIListDouble2")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::LabelStudio.OneOf<double?, global::System.Collections.Generic.Dictionary<string, double>>?), TypeInfoPropertyName = "NullableOneOfDoubleDictionaryStringDouble2")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List<global::LabelStudio.ActivityLog>))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List<string>))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List<global::LabelStudio.BlueprintList>))]
Expand Down Expand Up @@ -1558,6 +1560,10 @@ public override bool CanConvert(global::System.Type typeToConvert)

|| typeToConvert == typeof(global::LabelStudio.StateEnum?)

|| typeToConvert == typeof(global::LabelStudio.StateSourceEnum)

|| typeToConvert == typeof(global::LabelStudio.StateSourceEnum?)

|| typeToConvert == typeof(global::LabelStudio.StorageStatusEnum)

|| typeToConvert == typeof(global::LabelStudio.StorageStatusEnum?)
Expand Down Expand Up @@ -2305,6 +2311,16 @@ public override bool CanConvert(global::System.Type typeToConvert)
return new global::LabelStudio.JsonConverters.StateEnumNullableJsonConverter();
}

if (typeToConvert == typeof(global::LabelStudio.StateSourceEnum))
{
return new global::LabelStudio.JsonConverters.StateSourceEnumJsonConverter();
}

if (typeToConvert == typeof(global::LabelStudio.StateSourceEnum?))
{
return new global::LabelStudio.JsonConverters.StateSourceEnumNullableJsonConverter();
}

if (typeToConvert == typeof(global::LabelStudio.StorageStatusEnum))
{
return new global::LabelStudio.JsonConverters.StorageStatusEnumJsonConverter();
Expand Down
Loading
Loading