J-Tech-Japan / Sekiban

Sekiban - an Opinionated Event Sourcing and CQRS Framework using C#. It can store data into Azure Cosmos DB or AWS Dynamo DB
https://www.sekiban.dev
Other
41 stars 1 forks source link

500 Error on Accessing /api/info/aggregates via Swagger #162

Closed MOTOO11 closed 8 months ago

MOTOO11 commented 9 months ago

Upon launching the "BookBorrowing.Web.Cosmos" sample project and attempting to access the "/api/info/aggregates" endpoint through Swagger, a 500 Internal Server Error occurred.

image

Reproduction Steps

  1. Launch the "BookBorrowing.Web.Cosmos" sample project.
  2. Access Swagger UI.
  3. Navigate to the "/api/info/aggregates" endpoint.
  4. Observe the 500 Internal Server Error.
tomohisa commented 9 months ago

Thank you! I will check it out if it is the issue of the usage or the framework.

MOTOO11 commented 8 months ago
 "Object of type 'System.String' cannot be converted to type 'System.Collections.Generic.IEnumerable`1[System.ComponentModel.DataAnnotations.ValidationResult]'."

In SekibanApiListController.cs at line 80, I am attempting to create a CommandExecutorResponse using reflection. However, a string type is being passed to the constructor's IEnumerable<ValidationResult>? ValidationResults.

Likely, it does not support the generation of default instances for IEnumerable.

public record CommandExecutorResponse(
    Guid? AggregateId,
    Guid? CommandId,
    int Version,
    IEnumerable<ValidationResult>? ValidationResults,
    string? LastSortableUniqueId,
    string AggregatePayloadOutTypeName,
    int EventCount);

image