Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix Swashbuckle 6.9 OpenAPI generation for IFormFile upload endpoint
Swashbuckle 6.9+ requires IFormFile to be wrapped in a class when used
with [FromForm] rather than declared as a bare action parameter. Introduce
DatabaseImportRequest to satisfy this requirement and unblock the OpenAPI
guardrail CI check.
  • Loading branch information
Chris0Jeky committed Mar 29, 2026
commit 1e7b894003b3b98ee7cf60879925cf10cdcc6672
10 changes: 10 additions & 0 deletions backend/src/Taskdeck.Api/Contracts/DatabaseImportRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Taskdeck.Api.Contracts;

/// <summary>
/// Wraps the IFormFile upload for database import. Using a class wrapper is required
/// by Swashbuckle 6.9+ to correctly generate the OpenAPI schema for file uploads.
/// </summary>
public sealed class DatabaseImportRequest
{
public IFormFile? File { get; set; }
}
5 changes: 4 additions & 1 deletion backend/src/Taskdeck.Api/Controllers/ExportController.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Text.Json;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Taskdeck.Api.Contracts;
using Taskdeck.Api.Extensions;
using Taskdeck.Application.DTOs;
using Taskdeck.Application.Interfaces;
Expand Down Expand Up @@ -84,11 +85,13 @@ public async Task<IActionResult> ExportDatabase()

[HttpPost("import/database")]
[Consumes("multipart/form-data")]
public async Task<IActionResult> ImportDatabase([FromForm] IFormFile? file)
public async Task<IActionResult> ImportDatabase([FromForm] DatabaseImportRequest request)
{
if (!TryGetCurrentUserId(out var userId, out var errorResult))
return errorResult!;

var file = request.File;

if (file is null)
{
return Result
Expand Down
Loading