Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Freezor/bugfix/fix cannot upate properties #235 #238

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 23 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Updated
### Added

- Microsoft.IdentityModel.Tokens from **6.13.1** to **7.5.0** because of a package vulnerability.
- Test Project for `IO.Swagger.Lib.V3`. (@Freezor)
- New unit tests for `JsonSerializerStrategy`, `RequestMetadataMapper`, `ValueObjectParser`, `RequestValueMapper`, `ResponseValueMapper`, `ResponseValueTransformer`, `ValueOnlyJsonDeserializer`, and `ValueOnlyJsonSerializer`. (@Freezor)

### Changed

- Renamed Program1.cs to BlazorServerStarter for better readability and to avoid misunderstandings, as there already is a Program class.
- Cleaned BlazorServerStarter in general to have an easier understanding on the process
- Extracted dependency registration into DependencyRegistry.cs and server configuration into ServerConfiguration.cs from Startup.cs
- Refactored ServerConfiguration.cs into smaller parts and applying Clean code and SOLID principles.
- Refactored `SerializationModifiersValidator` for better testability and introduced `ISerializationModifiersValidator`. (@Freezor)
- Refactored `JsonSerializerStrategy` for better testability and introduced `IJsonSerializerStrategy`. (@Freezor)
- Simplified `AssetAdministrationShellService.IsSubmodelPresentWithinAAS` to reduce complexity overhead. (@Freezor)
- Refactored `AasResponseFormatter` and extracted JSON formatting into `IJsonSerializerStrategy`. (@Freezor)
- Refactored `MappingService` for simpler, more understandable code. (@Freezor)
- Refactored `RequestMetadataMapper` to apply best practices and design patterns. (@Freezor)
- Refactored `SerializationModifiersValidator` to apply best practices and design patterns. (@Freezor)
- Renamed Program1.cs to BlazorServerStarter for better readability and to avoid misunderstandings, as there already is a Program class. (@Freezor)
- Cleaned BlazorServerStarter in general to have an easier understanding on the process (@Freezor)
- Extracted dependency registration into DependencyRegistry.cs and server configuration into ServerConfiguration.cs from Startup.cs (@Freezor)
- Refactored ServerConfiguration.cs into smaller parts and applying Clean code and SOLID principles. (@Freezor)

### Updated

- Microsoft.IdentityModel.Tokens from **6.13.1** to **7.5.0** because of a package vulnerability. (@Freezor)

### Removed

- Unused method `EnumeratesChildren` in `ExtendIReferable`. (@Freezor)

## [Released]

### [x.x.x] - yyyy-mm-dd

Here comes the next release version.
Here comes the next release version
8 changes: 1 addition & 7 deletions src/AasxCsharpLibrary/Extensions/ExtendIReferable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ public static void CollectReferencesByParent(this IReferable referable, List<Key
}
public static void SetTimeStamp(this IReferable referable, DateTime timeStamp)
{
IReferable newReferable = referable;
var newReferable = referable;
newReferable.TimeStamp = timeStamp;
do
{
Expand All @@ -343,12 +343,6 @@ public static void SetTimeStamp(this IReferable referable, DateTime timeStamp)
while (newReferable != null);
}

public static bool EnumeratesChildren(this ISubmodelElement elem)
{
var num = elem.EnumerateChildren().Count();
return (num > 0);
}

public static IEnumerable<ISubmodelElement> EnumerateChildren(this IReferable referable)
{
if (referable is Submodel submodel && submodel.SubmodelElements != null)
Expand Down
20 changes: 20 additions & 0 deletions src/AasxServer.sln
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExampleClient", "ExampleCli
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AasxServerAspNetCore", "AasxServerAspNetCore\AasxServerAspNetCore.csproj", "{D467D497-18D8-4E26-8671-8AC73BE9AC4F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Lib.V3.Tests", "IO.Swagger.Lib.V3.Tests\IO.Swagger.Lib.V3.Tests.csproj", "{A798C1AD-A30B-41AB-B914-D1D228E35231}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -263,6 +265,24 @@ Global
{D467D497-18D8-4E26-8671-8AC73BE9AC4F}.Release|x64.Build.0 = Release|Any CPU
{D467D497-18D8-4E26-8671-8AC73BE9AC4F}.Release|x86.ActiveCfg = Release|Any CPU
{D467D497-18D8-4E26-8671-8AC73BE9AC4F}.Release|x86.Build.0 = Release|Any CPU
{A798C1AD-A30B-41AB-B914-D1D228E35231}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A798C1AD-A30B-41AB-B914-D1D228E35231}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A798C1AD-A30B-41AB-B914-D1D228E35231}.Debug|x64.ActiveCfg = Debug|Any CPU
{A798C1AD-A30B-41AB-B914-D1D228E35231}.Debug|x64.Build.0 = Debug|Any CPU
{A798C1AD-A30B-41AB-B914-D1D228E35231}.Debug|x86.ActiveCfg = Debug|Any CPU
{A798C1AD-A30B-41AB-B914-D1D228E35231}.Debug|x86.Build.0 = Debug|Any CPU
{A798C1AD-A30B-41AB-B914-D1D228E35231}.DebugSlow|Any CPU.ActiveCfg = Debug|Any CPU
{A798C1AD-A30B-41AB-B914-D1D228E35231}.DebugSlow|Any CPU.Build.0 = Debug|Any CPU
{A798C1AD-A30B-41AB-B914-D1D228E35231}.DebugSlow|x64.ActiveCfg = Debug|Any CPU
{A798C1AD-A30B-41AB-B914-D1D228E35231}.DebugSlow|x64.Build.0 = Debug|Any CPU
{A798C1AD-A30B-41AB-B914-D1D228E35231}.DebugSlow|x86.ActiveCfg = Debug|Any CPU
{A798C1AD-A30B-41AB-B914-D1D228E35231}.DebugSlow|x86.Build.0 = Debug|Any CPU
{A798C1AD-A30B-41AB-B914-D1D228E35231}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A798C1AD-A30B-41AB-B914-D1D228E35231}.Release|Any CPU.Build.0 = Release|Any CPU
{A798C1AD-A30B-41AB-B914-D1D228E35231}.Release|x64.ActiveCfg = Release|Any CPU
{A798C1AD-A30B-41AB-B914-D1D228E35231}.Release|x64.Build.0 = Release|Any CPU
{A798C1AD-A30B-41AB-B914-D1D228E35231}.Release|x86.ActiveCfg = Release|Any CPU
{A798C1AD-A30B-41AB-B914-D1D228E35231}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
12 changes: 10 additions & 2 deletions src/AasxServerAspNetCore/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using IO.Swagger.Lib.V3.Formatters;
using IO.Swagger.Lib.V3.Interfaces;
using IO.Swagger.Lib.V3.Middleware;
using IO.Swagger.Lib.V3.SerializationModifiers;
using IO.Swagger.Lib.V3.SerializationModifiers.Mappers;
using IO.Swagger.Lib.V3.SerializationModifiers.Mappers.ValueMappers;
using IO.Swagger.Lib.V3.Services;
Expand Down Expand Up @@ -68,6 +69,8 @@ public void ConfigureServices(IServiceCollection services)
services.AddControllers();
services.AddLazyResolution();
services.AddSingleton<IAuthorizationHandler, AasSecurityAuthorizationHandler>();
services.AddSingleton<ISerializationModifiersValidator, SerializationModifiersValidator>();;
services.AddSingleton<IJsonSerializerStrategy, JsonSerializerStrategy>();
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddSingleton<IRegistryInitializerService, RegistryInitializerService>();
services.AddScoped(typeof(IAppLogger<>), typeof(LoggerAdapter<>));
Expand Down Expand Up @@ -107,8 +110,13 @@ public void ConfigureServices(IServiceCollection services)
{
options.InputFormatters.RemoveType<Microsoft.AspNetCore.Mvc.Formatters.SystemTextJsonInputFormatter>();
options.OutputFormatters.RemoveType<Microsoft.AspNetCore.Mvc.Formatters.SystemTextJsonOutputFormatter>();
options.InputFormatters.Add(new AasRequestFormatter());
options.OutputFormatters.Add(new AasResponseFormatter());

var serviceProvider = services.BuildServiceProvider();
var serializationModifiersValidator = serviceProvider.GetService<ISerializationModifiersValidator>();
var jsonSerializerStrategy = serviceProvider.GetService<IJsonSerializerStrategy>();

options.InputFormatters.Add(new AasRequestFormatter(serializationModifiersValidator));
options.OutputFormatters.Add(new AasResponseFormatter(jsonSerializerStrategy));
options.InputFormatters.Add(new AasDescriptorRequestFormatter());
options.OutputFormatters.Add(new AasDescriptorResponseFormatter());

Expand Down
124 changes: 63 additions & 61 deletions src/AasxServerBlazor/AasxServerBlazor.csproj
Original file line number Diff line number Diff line change
@@ -1,65 +1,67 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<SatelliteResourceLanguages>en-US;de-DE</SatelliteResourceLanguages>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<SatelliteResourceLanguages>en-US;de-DE</SatelliteResourceLanguages>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>DEBUG;TRACE;UseAasxCompatibilityModels</DefineConstants>
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>DEBUG;TRACE;UseAasxCompatibilityModels</DefineConstants>
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<PropertyGroup>
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
</PropertyGroup>
<PropertyGroup>
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
</PropertyGroup>

<ItemGroup>
<Using Include="AasCore.Aas3_0" />
</ItemGroup>
<ItemGroup>
<Using Include="AasCore.Aas3_0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="HotChocolate.AspNetCore" Version="13.2.1" />
<PackageReference Include="Microsoft.AspNetCore.Components" Version="3.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="ScottPlot" Version="4.1.68" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.5.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="HotChocolate.AspNetCore" Version="13.2.1" />
<PackageReference Include="Microsoft.AspNetCore.Components" Version="3.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="ScottPlot" Version="4.1.68" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.5.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AasSecurity\AasSecurity.csproj" />
<ProjectReference Include="..\AasxServerStandardBib\AasxServerStandardBib.csproj" />
<ProjectReference Include="..\es6numberserializer\es6numberserializer.csproj" />
<ProjectReference Include="..\IO.Swagger.Lib.V3\IO.Swagger.Lib.V3.csproj" />
<ProjectReference Include="..\IO.Swagger.Registry.Lib.V3\IO.Swagger.Registry.Lib.V3.csproj" />
<!--<ProjectReference Include="..\IO.Swagger.AasEnvApi.V1RC03\src\IO.Swagger\IO.Swagger.AasEnvApi.V1RC03.csproj" />-->
<!--<ProjectReference Include="..\IO.Swagger.Lib\IO.Swagger.Lib.csproj" />-->
<ProjectReference Include="..\jsoncanonicalizer\jsoncanonicalizer.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AasSecurity\AasSecurity.csproj" />
<ProjectReference Include="..\AasxServerStandardBib\AasxServerStandardBib.csproj" />
<ProjectReference Include="..\es6numberserializer\es6numberserializer.csproj" />
<ProjectReference Include="..\IO.Swagger.Lib.V3\IO.Swagger.Lib.V3.csproj" />
<ProjectReference Include="..\IO.Swagger.Registry.Lib.V3\IO.Swagger.Registry.Lib.V3.csproj" />
<ProjectReference Include="..\jsoncanonicalizer\jsoncanonicalizer.csproj" />
</ItemGroup>

<ProjectExtensions><VisualStudio><UserProperties appsettings_1json__JsonSchema="Url&quot;" /></VisualStudio></ProjectExtensions>
<ProjectExtensions>
<VisualStudio>
<UserProperties appsettings_1json__JsonSchema="Url&quot;" />
</VisualStudio>
</ProjectExtensions>

<ItemGroup>
<Content Include="startForDemo.sh">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<ItemGroup>
<Content Include="startForDemo.sh">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

<Content Include="startForDemo.bat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Content Include="startForDemo.bat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<None Include="wwwroot\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="wwwroot\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<Content Remove="wwwroot\2022-02-15_IDTA_AAS-Logo_Final_RGB.png" />
Expand All @@ -73,14 +75,14 @@
<Content Remove="wwwroot\sm_icons\pcf v1.0.svg" />
</ItemGroup>

<ItemGroup>
<Folder Include="temp\" />
<Folder Include="wwwroot\images\scottplot\" />
</ItemGroup>
<ItemGroup>
<Folder Include="temp\" />
<Folder Include="wwwroot\images\scottplot\" />
</ItemGroup>

<ItemGroup>
<None Update="LICENSE.TXT">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
<ItemGroup>
<None Update="LICENSE.TXT">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/AasxServerBlazor/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
}
},
"DatabaseConnection": {
// "ConnectionString": "Host=localhost; Database=AAS; Username=postgres; Password=postres; Include Error Detail=true; Port=5432"
"ConnectionString": "Data Source=$DATAPATH\\database.db"
"ConnectionString": "Host=localhost; Database=AAS; Username=postgres; Password=postgres; Include Error Detail=true; Port=5432"
//"ConnectionString": "Data Source=$DATAPATH\\database.db"
},
"AllowedHosts": "*",
"SyntaxHighlight": false
Expand Down