Skip to content

Commit

Permalink
Fix bugs w.r.t. test-engine (#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
juileetikekar authored Jul 19, 2024
1 parent d46e7b3 commit e1fbe6c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ public virtual IActionResult GetAllAssetAdministrationShellsReference([FromQuery
var aasList = _aasService.GetAllAssetAdministrationShells(assetIds, idShort);
var aasPaginatedList = _paginationService.GetPaginatedList(aasList, new PaginationParameters(cursor, limit));
var references = _referenceModifierService.GetReferenceResult(aasPaginatedList.result.ConvertAll(a => (IReferable)a));
var output = new ReferencePagedResult {result = references, paging_metadata = aasPaginatedList.paging_metadata};
var output = new ReferencePagedResult(references, aasPaginatedList.paging_metadata);
return new ObjectResult(output);
}

Expand Down Expand Up @@ -676,7 +676,7 @@ public virtual IActionResult GetAllSubmodelElementsReferenceAasRepository([FromR
// TODO (jtikekar, 2023-09-04): check performace imapct due to ConvertAll
var smePaginated = _paginationService.GetPaginatedList(smeList, new PaginationParameters(cursor, limit));
var smeReferenceList = _referenceModifierService.GetReferenceResult(smePaginated.result.ConvertAll(sme => (IReferable)sme));
var output = new ReferencePagedResult {result = smeReferenceList, paging_metadata = smePaginated.paging_metadata};
var output = new ReferencePagedResult(smeReferenceList, smePaginated.paging_metadata);
return new ObjectResult(output);
}

Expand Down
4 changes: 2 additions & 2 deletions src/IO.Swagger.Lib.V3/Controllers/SubmodelRepositoryAPIApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ public virtual IActionResult GetAllSubmodelElementsReferenceSubmodelRepo([FromRo

var smePagedList = _paginationService.GetPaginatedList(smeList, new PaginationParameters(cursor, limit));
var smeReferences = _referenceModifierService.GetReferenceResult(smePagedList.result.ConvertAll(sme => (IReferable)sme));
var output = new ReferencePagedResult() {result = smeReferences, paging_metadata = smePagedList.paging_metadata};
var output = new ReferencePagedResult(smeReferences, smePagedList.paging_metadata);
return new ObjectResult(output);
}

Expand Down Expand Up @@ -830,7 +830,7 @@ public virtual IActionResult GetAllSubmodelsReference([FromQuery] [StringLength(

var submodelsPagedList = _paginationService.GetPaginatedList(submodelList, new PaginationParameters(cursor, limit));
var smReferences = _referenceModifierService.GetReferenceResult(submodelsPagedList.result.ConvertAll(sm => (IReferable)sm));
var output = new ReferencePagedResult() {result = smReferences, paging_metadata = submodelsPagedList.paging_metadata};
var output = new ReferencePagedResult(smReferences, submodelsPagedList.paging_metadata);
return new ObjectResult(output);
}

Expand Down
3 changes: 1 addition & 2 deletions src/IO.Swagger.Lib.V3/Formatters/AasRequestFormatter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using DataTransferObjects.MetadataDTOs;
using DataTransferObjects.MetadataDTOs;
using DataTransferObjects.ValueDTOs;
using IO.Swagger.Lib.V3.SerializationModifiers;
using IO.Swagger.Lib.V3.SerializationModifiers.Mappers.ValueMappers;
Expand Down Expand Up @@ -54,7 +54,6 @@ public override Task<InputFormatterResult> ReadRequestBodyAsync(InputFormatterCo
var request = context.HttpContext.Request;
object? result = null;


JsonNode node = System.Text.Json.JsonSerializer.DeserializeAsync<JsonNode>(request.Body).Result;

if (type == typeof(Submodel))
Expand Down
3 changes: 2 additions & 1 deletion src/IO.Swagger.Lib.V3/Middleware/ExceptionMiddleware.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using AasSecurity.Exceptions;
using AasSecurity.Exceptions;
using AasxServerStandardBib.Exceptions;
using AasxServerStandardBib.Logging;
using AdminShellNS.Exceptions;
Expand Down Expand Up @@ -88,6 +88,7 @@ private async Task HandleExceptionAsync(HttpContext context, Exception exception
message.MessageType = MessageTypeEnum.Error;
break;
}
case Jsonization.Exception:
case InvalidIdShortPathException:
case InvalidUpdateResourceException:
case EmptyCursorException:
Expand Down
10 changes: 6 additions & 4 deletions src/IO.Swagger.Lib.V3/Models/ReferencePagedResult.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
using IO.Swagger.Models;
using IO.Swagger.Models;
using System.Collections.Generic;

namespace IO.Swagger.Lib.V3.Models
{
public class ReferencePagedResult : PagedResult
{
public new List<IReference>? result { get; set; }

public new PagedResultPagingMetadata? paging_metadata { get; set; }
public ReferencePagedResult(List<IReference>? result, PagedResultPagingMetadata? pagingMetadata)
{
this.result = result.ConvertAll(a=> (IClass)a);
paging_metadata = pagingMetadata;
}
}
}

0 comments on commit e1fbe6c

Please sign in to comment.