diff --git a/app/src/Passingwind.WorkflowApp.Web/SwaggerEnumDescriptions.cs b/app/src/Passingwind.WorkflowApp.Web/SwaggerEnumDescriptions.cs deleted file mode 100644 index 76e2129a..00000000 --- a/app/src/Passingwind.WorkflowApp.Web/SwaggerEnumDescriptions.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Linq; -using Microsoft.OpenApi.Any; -using Microsoft.OpenApi.Models; -using Swashbuckle.AspNetCore.SwaggerGen; - -namespace Passingwind.WorkflowApp.Web; - -public class SwaggerEnumDescriptions : ISchemaFilter -{ - public void Apply(OpenApiSchema schema, SchemaFilterContext context) - { - var type = context.Type; - - if (type.IsEnum) - { - var names = Enum.GetNames(type); - - var values2 = new OpenApiArray(); - - values2.AddRange(names.Select(x => new OpenApiObject - { - ["name"] = new OpenApiString(Convert.ToInt32(Enum.Parse(type, x)).ToString()), - ["value"] = new OpenApiString(x), - })); - - var values1 = new OpenApiArray(); - values1.AddRange(names.Select(x => new OpenApiString(x))); - - schema.Extensions.Add( - "x-enumNames", - values1 - ); - - schema.Extensions.Add( - "x-ms-enum", - new OpenApiObject - { - ["name"] = new OpenApiString(type.Name), - ["modelAsString"] = new OpenApiBoolean(true), - ["values"] = values2, - } - ); - } - } -} diff --git a/app/src/Passingwind.WorkflowApp.Web/WorkflowAppWebModule.cs b/app/src/Passingwind.WorkflowApp.Web/WorkflowAppWebModule.cs index e415aae5..642f5b02 100644 --- a/app/src/Passingwind.WorkflowApp.Web/WorkflowAppWebModule.cs +++ b/app/src/Passingwind.WorkflowApp.Web/WorkflowAppWebModule.cs @@ -194,7 +194,7 @@ private static void ConfigureNewtonsoftJsonSerializerSettings(JsonSerializerSett settings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; settings.NullValueHandling = NullValueHandling.Ignore; settings.DefaultValueHandling = DefaultValueHandling.Include; - settings.TypeNameHandling = TypeNameHandling.None; // As default, we want output the type name of json object + settings.TypeNameHandling = TypeNameHandling.None; settings.TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple; settings.PreserveReferencesHandling = PreserveReferencesHandling.None; } diff --git a/src/Passingwind.Abp.ElsaModule.Domain/SystemTextJson/Converters/ObjectConverter.cs b/src/Passingwind.Abp.ElsaModule.Domain/SystemTextJson/Converters/ObjectConverter.cs index 42586cad..b5132164 100644 --- a/src/Passingwind.Abp.ElsaModule.Domain/SystemTextJson/Converters/ObjectConverter.cs +++ b/src/Passingwind.Abp.ElsaModule.Domain/SystemTextJson/Converters/ObjectConverter.cs @@ -35,6 +35,6 @@ public override object Read(ref Utf8JsonReader reader, Type typeToConvert, JsonS public override void Write(Utf8JsonWriter writer, object value, JsonSerializerOptions options) { - writer.WriteRawValue(Newtonsoft.Json.JsonConvert.SerializeObject(value, JsonSerializerSettings)); + writer.WriteRawValue(JsonConvert.SerializeObject(value, JsonSerializerSettings)); } } diff --git a/src/Passingwind.Abp.ElsaModule.Domain/SystemTextJson/Converters/ObjectToDictionaryConverter.cs b/src/Passingwind.Abp.ElsaModule.Domain/SystemTextJson/Converters/ObjectToDictionaryConverter.cs index 201085ce..be6ac306 100644 --- a/src/Passingwind.Abp.ElsaModule.Domain/SystemTextJson/Converters/ObjectToDictionaryConverter.cs +++ b/src/Passingwind.Abp.ElsaModule.Domain/SystemTextJson/Converters/ObjectToDictionaryConverter.cs @@ -1,11 +1,12 @@ using System; using System.Collections.Generic; using System.Text.Json; -using System.Text.Json.Serialization; +using Newtonsoft.Json; +using JsonException = System.Text.Json.JsonException; namespace Passingwind.Abp.ElsaModule.SystemTextJson.Converters; -public class ObjectToDictionaryConverter : JsonConverter> +public class ObjectToDictionaryConverter : System.Text.Json.Serialization.JsonConverter> { public override Dictionary Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { @@ -81,73 +82,6 @@ private object ExtractValue(ref Utf8JsonReader reader, JsonSerializerOptions opt public override void Write(Utf8JsonWriter writer, Dictionary value, JsonSerializerOptions options) { - writer.WriteStartObject(); - - foreach (var key in value.Keys) - { - HandleValue(writer, key, value[key]); - } - - writer.WriteEndObject(); - } - - private static void HandleValue(Utf8JsonWriter writer, string key, object objectValue) - { - if (key != null) - { - writer.WritePropertyName(key); - } - - switch (objectValue) - { - case string stringValue: - writer.WriteStringValue(stringValue); - break; - case DateTime dateTime: - writer.WriteStringValue(dateTime); - break; - case long longValue: - writer.WriteNumberValue(longValue); - break; - case int intValue: - writer.WriteNumberValue(intValue); - break; - case float floatValue: - writer.WriteNumberValue(floatValue); - break; - case double doubleValue: - writer.WriteNumberValue(doubleValue); - break; - case decimal decimalValue: - writer.WriteNumberValue(decimalValue); - break; - case bool boolValue: - writer.WriteBooleanValue(boolValue); - break; - case Dictionary dict: - writer.WriteStartObject(); - foreach (var item in dict) - { - HandleValue(writer, item.Key, item.Value); - } - writer.WriteEndObject(); - break; - case object[] array: - writer.WriteStartArray(); - foreach (var item in array) - { - HandleValue(writer, item); - } - writer.WriteEndArray(); - break; - default: - writer.WriteNullValue(); - break; - } - } - - private static void HandleValue(Utf8JsonWriter writer, object value) - { - HandleValue(writer, null, value); + writer.WriteRawValue(JsonConvert.SerializeObject(value)); } } diff --git a/src/Passingwind.Abp.ElsaModule.EntityFrameworkCore/EntityFrameworkCore/EfCoreJsonValueConverter.cs b/src/Passingwind.Abp.ElsaModule.EntityFrameworkCore/EntityFrameworkCore/EfCoreJsonValueConverter.cs index ae319d5b..8d33d295 100644 --- a/src/Passingwind.Abp.ElsaModule.EntityFrameworkCore/EntityFrameworkCore/EfCoreJsonValueConverter.cs +++ b/src/Passingwind.Abp.ElsaModule.EntityFrameworkCore/EntityFrameworkCore/EfCoreJsonValueConverter.cs @@ -13,11 +13,11 @@ namespace Passingwind.Abp.ElsaModule.EntityFrameworkCore; public class EfCoreJsonValueConverter : ValueConverter { - public static Func Create; + public static Func CreateSettingsFunc; static EfCoreJsonValueConverter() { - Create = () => + CreateSettingsFunc = () => { var settings = new JsonSerializerSettings() { @@ -56,13 +56,13 @@ private static void JsonErrorHandle(object sender, ErrorEventArgs e) private static string Serialize(T value) { - var settings = Create(); + var settings = CreateSettingsFunc(); return JsonConvert.SerializeObject(value, Formatting.None, settings); } private static T Deserialize(string json) { - var settings = Create(); + var settings = CreateSettingsFunc(); return JsonConvert.DeserializeObject(json, settings); } } diff --git a/src/Passingwind.ElsaDesigner/package.json b/src/Passingwind.ElsaDesigner/package.json index 9f72f5f1..ef6b78d7 100644 --- a/src/Passingwind.ElsaDesigner/package.json +++ b/src/Passingwind.ElsaDesigner/package.json @@ -75,6 +75,7 @@ }, "devDependencies": { "@ant-design/pro-cli": "^2.1.5", + "@babel/runtime": "^7.23.8", "@playwright/test": "^1.17.0", "@types/classnames": "^2.3.1", "@types/express": "^4.17.14", diff --git a/src/Passingwind.ElsaDesigner/src/pages/workflow/code-block/edit.tsx b/src/Passingwind.ElsaDesigner/src/pages/workflow/code-block/edit.tsx index bb71dc93..d4896e83 100644 --- a/src/Passingwind.ElsaDesigner/src/pages/workflow/code-block/edit.tsx +++ b/src/Passingwind.ElsaDesigner/src/pages/workflow/code-block/edit.tsx @@ -126,6 +126,7 @@ const Edit: React.FC = () => { label={intl.formatMessage({ id: 'page.globalCode.field.description' })} name="description" rules={[{ max: 128 }]} + width="lg" fieldProps={{ rows: 1 }} />