Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
Supporting empty data specifications while conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
juileetikekar committed Oct 12, 2023
1 parent e86c112 commit 4dbfada
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 5 additions & 2 deletions src/AasCore.Aas3_0/xmlization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
* Do NOT edit or append.
*/

using System.Collections.Generic; // can't alias
using Aas = AasCore.Aas3_0; // renamed
using CodeAnalysis = System.Diagnostics.CodeAnalysis;
using Xml = System.Xml;

using System.Collections.Generic; // can't alias

namespace AasCore.Aas3_0
{
/// <summary>
Expand Down Expand Up @@ -24657,6 +24656,10 @@ private void ReferenceToSequence(
Aas.IReference that,
Xml.XmlWriter writer)
{
if (that == null)
{
return;
}
writer.WriteStartElement(
"type",
NS);
Expand Down
7 changes: 2 additions & 5 deletions src/AasxCsharpLibrary/Extensions/ExtendISubmodelElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -359,13 +359,10 @@ private static void BasicConversionFromV10(this ISubmodelElement submodelElement
}
}

if (sourceSubmodelElement.hasDataSpecification != null)
if (sourceSubmodelElement.hasDataSpecification != null && !sourceSubmodelElement.hasDataSpecification.reference.IsNullOrEmpty())
{
//TODO (jtikekar, 0000-00-00): EmbeddedDataSpecification?? (as per old implementation)
if (submodelElement.EmbeddedDataSpecifications == null)
{
submodelElement.EmbeddedDataSpecifications = new List<IEmbeddedDataSpecification>();
}
submodelElement.EmbeddedDataSpecifications ??= new List<IEmbeddedDataSpecification>();
foreach (var dataSpecification in sourceSubmodelElement.hasDataSpecification.reference)
{
if (!dataSpecification.IsEmpty)
Expand Down

0 comments on commit 4dbfada

Please sign in to comment.