Empty DTO list from swagger
For some reason whatever list of sizes I input, it always tells me in the debugger that the list of ProductCreateSizeRequests is empty.
,
public class CreateProductRequest
{
public string Name { get; set; }
public double Price { get; set; }
public string Category { get; set; }
public string Subcategory { get; set; }
public string Color { get; set; }
public int? ThumbnailIndex { get; set; }
public List<ProductCreateSizeRequest> Sizes { get; set; }
public List<IFormFile> Images { get; set; }
}public class CreateProductRequest
{
public string Name { get; set; }
public double Price { get; set; }
public string Category { get; set; }
public string Subcategory { get; set; }
public string Color { get; set; }
public int? ThumbnailIndex { get; set; }
public List<ProductCreateSizeRequest> Sizes { get; set; }
public List<IFormFile> Images { get; set; }
}public override async Task<ActionResult<Product>> CreateProduct(CreateProductRequest request)
{
_logger.LogInformation("POST Rest Request: Create product.");
try
{
Product product = await _productCommandService.CreateProduct(request);
foreach (IFormFile imageFile in request.Images)
{
string? response = await CreateImageForProductCreation(product.Id, imageFile);
if (response != null)
{
_logger.LogInformation($"Image Creation Response: " + response);
}
}
foreach (ProductCreateSizeRequest size in request.Sizes)
{
_logger.LogInformation("AICI E PROBLEMA");
string? response = await CreateSizeForProductCreation(product.Id, size);
if (response != null)
{
_logger.LogInformation($"Size Creation Response: " + response);
}
}
return Created(GenerateUriForProduct(product.Id), product);
}
catch (InvalidValue exception)
{
_logger.LogInformation("400 Rest Response: " + exception.Message);
return BadRequest(exception.Message);
}
}public override async Task<ActionResult<Product>> CreateProduct(CreateProductRequest request)
{
_logger.LogInformation("POST Rest Request: Create product.");
try
{
Product product = await _productCommandService.CreateProduct(request);
foreach (IFormFile imageFile in request.Images)
{
string? response = await CreateImageForProductCreation(product.Id, imageFile);
if (response != null)
{
_logger.LogInformation($"Image Creation Response: " + response);
}
}
foreach (ProductCreateSizeRequest size in request.Sizes)
{
_logger.LogInformation("AICI E PROBLEMA");
string? response = await CreateSizeForProductCreation(product.Id, size);
if (response != null)
{
_logger.LogInformation($"Size Creation Response: " + response);
}
}
return Created(GenerateUriForProduct(product.Id), product);
}
catch (InvalidValue exception)
{
_logger.LogInformation("400 Rest Response: " + exception.Message);
return BadRequest(exception.Message);
}
}

