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
19 changes: 12 additions & 7 deletions .github/workflows/nugetci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,17 @@ jobs:
- name: dotnet pack
run: dotnet pack RulesEngineEditor.sln -c Release --no-build --include-source --include-symbols -o nupkg

- name: Publish NuGet packages
- name: setup nuget
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: NuGet/setup-nuget@v1.0.6
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
shell: pwsh
run: |
echo "Packing results:"
Get-ChildItem -Recurse nupkg | Format-List -Property FullName,Length
dotnet nuget push "nupkg/*.nupkg" -s https://api.nuget.org/v3/index.json -k $env:NUGET_API_KEY --skip-duplicate
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
nuget-version: latest

- name: Publish NuGet
uses: brandedoutcast/publish-nuget@v2
with:
PROJECT_FILE_PATH: src/RulesEngineEditor/RulesEngineEditor.csproj
NUGET_KEY: ${{ secrets.NUGET_API_KEY }}
PACKAGE_NAME: RulesEngineEditor
14 changes: 8 additions & 6 deletions src/RulesEngineEditor/Pages/RulesEngineEditorPage.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
string inputJSONErrors;
string _inputJSON;
[Parameter]
public string InputJSON { get { return _inputJSON; } set { _inputJSON = value; InputJSONUpdate(); RunRE(); } }

Check warning on line 67 in src/RulesEngineEditor/Pages/RulesEngineEditorPage.razor.cs

View workflow job for this annotation

GitHub Actions / build

'RulesEngineEditorPage.InputJSONUpdate()' is obsolete: 'InputRule is deprecated. Use InputRuleName instead.'

[Parameter]
public EventCallback<string> InputJSONChanged { get; set; }
Expand All @@ -80,12 +80,9 @@

protected override async Task OnInitializedAsync()
{
jsonOptions = new JsonSerializerOptions {
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
jsonOptions = new JsonSerializerOptions(RulesEngineJsonSourceContext.Default.Options) {
IncludeFields = true,
WriteIndented = true,
Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
PropertyNameCaseInsensitive = true,
Converters = { new JsonStringEnumConverter() }
};

Expand Down Expand Up @@ -207,7 +204,12 @@

private void UpdateInputs()
{
var serializationOptions = new JsonSerializerOptions { Converters = { new JsonStringEnumConverter() } };
var serializationOptions = new JsonSerializerOptions {
Converters = { new JsonStringEnumConverter() },
WriteIndented = true,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping
};

inputJSONErrors = "";
List<InputRuleParameterDictionary> newInputs = new List<InputRuleParameterDictionary>();
Expand All @@ -233,7 +235,7 @@

if (inputJSONErrors == "")
{
InputJSON = JsonNormalizer.Normalize(JsonSerializer.Serialize(newInputs, jsonOptions));
InputJSON = JsonNormalizer.Normalize(JsonSerializer.Serialize(newInputs, serializationOptions));
}
}

Expand Down Expand Up @@ -366,7 +368,7 @@
var selectedFile = files.File;
StreamReader sr = new StreamReader(selectedFile.OpenReadStream());
InputJSON = JsonNormalizer.Normalize(await sr.ReadToEndAsync());
InputJSONUpdate();

Check warning on line 371 in src/RulesEngineEditor/Pages/RulesEngineEditorPage.razor.cs

View workflow job for this annotation

GitHub Actions / build

'RulesEngineEditorPage.InputJSONUpdate()' is obsolete: 'InputRule is deprecated. Use InputRuleName instead.'
ShowWorkflows = true;
WorkflowService.WorkflowUpdate();
}
Expand Down
6 changes: 3 additions & 3 deletions src/RulesEngineEditor/RulesEngineEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<PackageReleaseNotes>https://github.com/alexreich/RulesEngineEditor/blob/main/CHANGELOG.md</PackageReleaseNotes>
<PackageIcon>RulesEngineEditor.png</PackageIcon>
<PackageIconUrl />
<Version>1.4.5</Version>
<AssemblyVersion>1.4.5.0</AssemblyVersion>
<FileVersion>1.4.5.0</FileVersion>
<Version>1.4.6</Version>
<AssemblyVersion>1.4.6.0</AssemblyVersion>
<FileVersion>1.4.6.0</FileVersion>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
<ItemGroup>
Expand Down
11 changes: 11 additions & 0 deletions src/RulesEngineEditor/Shared/RulesEngineJsonSourceContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,25 @@
{
[JsonSourceGenerationOptions(
WriteIndented = true,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
PropertyNameCaseInsensitive = true,
GenerationMode = JsonSourceGenerationMode.Default)]
[JsonSerializable(typeof(Workflow[]))]
[JsonSerializable(typeof(RuleData))]
[JsonSerializable(typeof(RuleActions))]
[JsonSerializable(typeof(List<WorkflowData>))] // Added for WorkflowData list
[JsonSerializable(typeof(InputRuleParameterDictionary))] // Added for InputRuleParameterDictionary
[JsonSerializable(typeof(List<InputRuleParameterDictionary>))] // Added for list of InputRuleParameterDictionary
[JsonSerializable(typeof(JsonElement))] // Added for dynamic JSON deserialization
// Primitive types for Dictionary<string, object> values in InputRuleParameterDictionary
[JsonSerializable(typeof(string))]
[JsonSerializable(typeof(int))]
[JsonSerializable(typeof(long))]
[JsonSerializable(typeof(double))]
[JsonSerializable(typeof(bool))]
[JsonSerializable(typeof(decimal))]
[JsonSerializable(typeof(object))]
public partial class RulesEngineJsonSourceContext : JsonSerializerContext

Check warning on line 31 in src/RulesEngineEditor/Shared/RulesEngineJsonSourceContext.cs

View workflow job for this annotation

GitHub Actions / build

The member 'RulesEngine.Models.Rule.RuleExpressionType' has been annotated with 'JsonStringEnumConverter' which is not supported in native AOT. Consider using the generic 'JsonStringEnumConverter<TEnum>' instead. (https://learn.microsoft.com/dotnet/fundamentals/syslib-diagnostics/syslib1034)

Check warning on line 31 in src/RulesEngineEditor/Shared/RulesEngineJsonSourceContext.cs

View workflow job for this annotation

GitHub Actions / build

The member 'RulesEngine.Models.Rule.RuleExpressionType' has been annotated with 'JsonStringEnumConverter' which is not supported in native AOT. Consider using the generic 'JsonStringEnumConverter<TEnum>' instead. (https://learn.microsoft.com/dotnet/fundamentals/syslib-diagnostics/syslib1034)
{
// Removed manually implemented members.
}
Expand Down
Loading