Skip to content

Design validation for Minimal APIs #30666

@halter73

Description

@halter73

Idea:

// Step 5: Input validation
app.MapPost("/todos", async (Validated<Todo> inputTodo, TodoDb db) =>
{
    var (todo, isValid) = inputTodo;
    if (!isValid) return Problem(inputTodo);

    db.Todos.Add(todo);
    await db.SaveChangesAsync();

    return CreatedAt(routes.GetTodo.Url(todo.Id), todo);
};

From: #30580

Metadata

Metadata

Assignees

Labels

Needs: DesignThis issue requires design work before implementating.Priority:2Work that is important, but not critical for the releasearea-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-minimal-actionsController-like actions for endpoint routingold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labelstriage-focusAdd this label to flag the issue for focus at triage

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions