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
Expand Up @@ -132,8 +132,8 @@ public static string CreateShellDescriptors() => """
"displayName": null,
"extensions": null,
"administration": null,
"assetKind": 0,
"assetType": 0,
"assetKind": "Type",
"assetType": "Type",
"endpoints": [
{
"interface": "AAS-3.0",
Expand All @@ -159,8 +159,8 @@ public static string CreateShellDescriptors() => """
"displayName": null,
"extensions": null,
"administration": null,
"assetKind": 0,
"assetType": 0,
"assetKind": "Type",
"assetType": "Type",
"endpoints": [
{
"interface": "AAS-3.0",
Expand Down Expand Up @@ -191,8 +191,8 @@ public static string CreateShellDescriptor() => """
"displayName": null,
"extensions": null,
"administration": null,
"assetKind": 0,
"assetType": 0,
"assetKind": "Type",
"assetType": "Type",
"endpoints": [
{
"interface": "AAS-3.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using AAS.TwinEngine.DataEngine.Api.AasRegistry.MappingProfiles;
using System.Text.Json;

using AAS.TwinEngine.DataEngine.Api.AasRegistry.MappingProfiles;
using AAS.TwinEngine.DataEngine.DomainModel.AasRegistry;
using AAS.TwinEngine.DataEngine.UnitTests.Api.Shared.MappingProfiles;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using AAS.TwinEngine.DataEngine.DomainModel.AasRegistry;
using AAS.TwinEngine.DataEngine.Infrastructure.Http.Clients;

using AasCore.Aas3_0;

using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

Expand Down Expand Up @@ -44,6 +46,7 @@ public async Task GetSubmodelTemplateAsync_ReturnsSubmodel_WhenValidResponse()

Assert.Equal("TestId", result.Id);
Assert.Equal("Test", result.IdShort);
Assert.Equal(ModellingKind.Instance, result.Kind);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ public async Task<ISubmodel> GetSubmodelTemplateAsync(string templateId, Cancell
try
{
var jsonNode = JsonNode.Parse(content);
return Jsonization.Deserialize.SubmodelFrom(jsonNode!);
var submodel = Jsonization.Deserialize.SubmodelFrom(jsonNode!);
UpdateSubmodelTemplateKind(submodel);
return submodel;
}
catch (JsonException ex)
{
Expand Down Expand Up @@ -245,4 +247,6 @@ private async Task<HttpResponseMessage> SendGetRequestAsync(string url, string h
throw new ValidationFailedException();
}
}

private static void UpdateSubmodelTemplateKind(ISubmodel submodel) => submodel.Kind = ModellingKind.Instance;
}
10 changes: 8 additions & 2 deletions source/AAS.TwinEngine.DataEngine/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using AAS.TwinEngine.DataEngine.ApplicationLogic.Exceptions.Infrastructure;
using System.Text.Json.Serialization;

using AAS.TwinEngine.DataEngine.ApplicationLogic.Exceptions.Infrastructure;
using AAS.TwinEngine.DataEngine.Infrastructure.Http.Authorization.Middleware;
using AAS.TwinEngine.DataEngine.Infrastructure.Monitoring;
using AAS.TwinEngine.DataEngine.Infrastructure.Providers.PluginDataProvider.Services;
Expand Down Expand Up @@ -33,7 +35,11 @@ public static async Task Main(string[] args)
builder.Services.ConfigureResponseCompression();
_ = builder.Services.AddAuthorization();

_ = builder.Services.AddControllers();
_ = builder.Services.AddControllers()
.AddJsonOptions(options =>
{
options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
});

_ = builder.Services.AddEndpointsApiExplorer();
_ = builder.Services.AddOpenApiDocument(settings =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"displayName": null,
"extensions": null,
"administration": null,
"assetKind": 0,
"assetType": 0,
"assetKind": "Type",
"assetType": "Type",
"endpoints": [
{
"interface": "AAS-3.0",
Expand All @@ -35,8 +35,8 @@
"displayName": null,
"extensions": null,
"administration": null,
"assetKind": 0,
"assetType": 0,
"assetKind": "Type",
"assetType": "Type",
"endpoints": [
{
"interface": "AAS-3.0",
Expand All @@ -62,8 +62,8 @@
"displayName": null,
"extensions": null,
"administration": null,
"assetKind": 0,
"assetType": 0,
"assetKind": "Type",
"assetType": "Type",
"endpoints": [
{
"interface": "AAS-3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"displayName": null,
"extensions": null,
"administration": null,
"assetKind": 0,
"assetType": 0,
"assetKind": "Type",
"assetType": "Type",
"endpoints": [
{
"interface": "AAS-3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"idShort": "ContactInformations",
"id": "https://mm-software.com/submodel/000-001/ContactInformation",
"semanticId": {
"type": 0,
"type": "ExternalReference",
"referredSemanticId": null,
"keys": null
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"idShort": "CustomSubmodel",
"id": "https://mm-software.com/submodel/000-001/CustomSubmodel",
"semanticId": {
"type": 0,
"type": "ExternalReference",
"referredSemanticId": null,
"keys": null
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
"idShort": "HandoverDocumentation",
"id": "https://mm-software.com/submodel/000-001/HandoverDocumentation",
"semanticId": {
"type": 0,
"type": "ExternalReference",
"referredSemanticId": null,
"keys": null
},
"supplementalSemanticId": [
{
"type": 0,
"type": "ExternalReference",
"referredSemanticId": null,
"keys": null
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"idShort": "ContactInformations",
"id": "https://mm-software.com/submodel/000-001/ContactInformation",
"kind": "Template",
"kind": "Instance",
"semanticId": {
"type": "ModelReference",
"keys": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}
],
"id": "https://mm-software.com/submodel/000-001/CustomSubmodel",
"kind": "Template",
"kind": "Instance",
"semanticId": {
"type": "ExternalReference",
"keys": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"templateId": "https://admin-shell.io/idta-02004-2-0"
},
"id": "https://mm-software.com/submodel/000-001/HandoverDocumentation",
"kind": "Template",
"kind": "Instance",
"semanticId": {
"type": "ModelReference",
"keys": [
Expand Down
Loading