Skip to content

Commit

Permalink
Removing support of Path on AnnotatedRelationshipElement
Browse files Browse the repository at this point in the history
  • Loading branch information
juileetikekar committed Nov 4, 2024
1 parent ad136e6 commit 5eb7d44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
5 changes: 2 additions & 3 deletions src/IO.Swagger.Lib.V3/Controllers/SubmodelRepositoryAPIApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ public virtual IActionResult GetAllSubmodelElements([FromRoute][Required] string
[SwaggerResponse(statusCode: 500, type: typeof(Result), description: "Internal Server Error")]
[SwaggerResponse(statusCode: 0, type: typeof(Result), description: "Default error handling for unmentioned status codes")]
public virtual IActionResult GetAllSubmodelElementsMetadataSubmodelRepo([FromRoute] [Required] string submodelIdentifier,
[FromQuery] int? limit, [FromQuery] string? cursor, [FromQuery] LevelEnum level,
[FromQuery] int? limit, [FromQuery] string? cursor,
[FromQuery] string? diff)
{
var decodedSubmodelIdentifier = _decoderService.Decode("submodelIdentifier", submodelIdentifier);
Expand Down Expand Up @@ -441,8 +441,7 @@ public virtual IActionResult GetAllSubmodelElementsMetadataSubmodelRepo([FromRou
filtered = smeList;

var smePagedList = _paginationService.GetPaginatedList(filtered, new PaginationParameters(cursor, limit));
var smeListLevel = _levelExtentModifierService.ApplyLevelExtent(smePagedList.result, level);
var smeMetadataList = _mappingService.Map(smeListLevel, "metadata");
var smeMetadataList = _mappingService.Map(smePagedList.result, "metadata");
var output = new MetadataPagedResult() {result = smeMetadataList.ConvertAll(sme => (IMetadataDTO)sme), paging_metadata = smePagedList.paging_metadata};
return new ObjectResult(output);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,16 @@ public List<string> TransformAdministrativeInformation(IAdministrativeInformatio

public List<string> TransformAnnotatedRelationshipElement(IAnnotatedRelationshipElement that, PathModifierContext context)
{
if (context.IdShortPaths.Count == 0 || string.IsNullOrEmpty(context.ParentPath))
if (context.IsRoot && !context.IsGetAllSmes)
throw new InvalidSerializationModifierException("Path", that.GetType().Name);
if (string.IsNullOrEmpty(context.ParentPath))
{
context.IdShortPaths.Add(that.IdShort);
}
else
{
context.IdShortPaths.Add($"{context.ParentPath}.{that.IdShort}");
}

if (that.Annotations != null)
{
var currentParentPath = string.IsNullOrEmpty(context.ParentPath) ? that.IdShort : $"{context.ParentPath}.{that.IdShort}";
foreach (ISubmodelElement? item in that.Annotations)
{
context.IsRoot = false;
context.ParentPath = currentParentPath;
Transform(item, context);
}
}

return context.IdShortPaths;
}

Expand Down

0 comments on commit 5eb7d44

Please sign in to comment.