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 @@ -2,8 +2,6 @@

using AasCore.Aas3_0;

using Microsoft.VisualStudio.TestPlatform.ObjectModel;

using File = AasCore.Aas3_0.File;
using Key = AasCore.Aas3_0.Key;
using Range = AasCore.Aas3_0.Range;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,11 @@ private ISubmodelElement GetElementFromListByIndex(IEnumerable<ISubmodelElement>
throw new InternalDataProcessingException();
}

if (list.TypeValueListElement is AasSubmodelElements.SubmodelElementCollection or AasSubmodelElements.SubmodelElementList && list.Value?.Count >0)
{
return list.Value.FirstOrDefault()!;
}

if (index >= 0 && index < list.Value!.Count)
{
return list.Value[index];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public SemanticTreeNode Merge(SemanticTreeNode globalTree, IList<SemanticTreeNod
};
}

private static SemanticTreeNode MergeBranch(SemanticBranchNode branch, IList<SemanticTreeNode> valueTrees)
private SemanticTreeNode MergeBranch(SemanticBranchNode branch, IList<SemanticTreeNode> valueTrees)
{
var mergedBranch = new SemanticBranchNode(branch.SemanticId, branch.Cardinality);

Expand Down Expand Up @@ -241,8 +241,14 @@ private static List<SemanticTreeNode> MergeBranchNodes(SemanticBranchNode templa
}
}

private static List<SemanticTreeNode> FindMatchingNodes(IEnumerable<SemanticTreeNode> valueTrees, string semanticId)
private List<SemanticTreeNode> FindMatchingNodes(IEnumerable<SemanticTreeNode> valueTrees, string semanticId)
{
if (semanticId.Contains(_submodelElementIndexContextPrefix, StringComparison.Ordinal))
{
var indexPrefixIndex = semanticId.IndexOf(_submodelElementIndexContextPrefix, StringComparison.OrdinalIgnoreCase);
semanticId = semanticId[..indexPrefixIndex];
}

var matches = new List<SemanticTreeNode>();

foreach (var vt in valueTrees.OfType<SemanticBranchNode>())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using AAS.TwinEngine.DataEngine.DomainModel.Plugin;
using AAS.TwinEngine.DataEngine.DomainModel.SubmodelRepository;
using AAS.TwinEngine.DataEngine.Infrastructure.Providers.PluginDataProvider.Helper;
using AAS.TwinEngine.DataEngine.Infrastructure.Shared;

using Json.Schema;

Expand Down Expand Up @@ -82,7 +83,7 @@ public async Task<ShellDescriptorsMetaData> GetDataForAllShellDescriptorsAsync(i

try
{
var shellDescriptorData = JsonSerializer.Deserialize<ShellDescriptorsMetaData>(responseContent);
var shellDescriptorData = JsonSerializer.Deserialize<ShellDescriptorsMetaData>(responseContent, JsonSerializationOptions.DeserializationOption);
if (shellDescriptorData == null)
{
logger.LogError("Failed to deserialize All ShellDescriptorData. Response content: {Content}", responseContent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public string GetProductIdFromRule(string aasIdentifier)
})
.Where(x => x.Parts is { Length: >= 1 } && x.Rule.Index > 0 && x.Parts.Length >= x.Rule.Index)
.Select(x => x.Parts![x.Rule.Index - 1])
.FirstOrDefault();
.FirstOrDefault(extractedId => !string.Equals(extractedId, aasIdentifier, StringComparison.Ordinal));

if (!string.IsNullOrEmpty(productId))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,9 @@ public static class JsonSerializationOptions
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) }
};

public static readonly JsonSerializerOptions DeserializationOption = new()
{
PropertyNameCaseInsensitive = true
};
}
Loading