Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
seungyongshim committed Feb 18, 2024
1 parent 3f1d26b commit 0280a2f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/WebApplicationMinimalApi8/Dto/PersonDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace WebApplicationMinimalApi8.Dto;

public record PersonDto
{
public required string Name { get; init; }
public required int Age { get; init; }
public IEnumerable<string> Emails { get; init; } = [];
}
10 changes: 10 additions & 0 deletions src/WebApplicationMinimalApi8/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@
.WithName("InternalException")
.WithOpenApi();

root.MapPost("/Persons", (PersonDto person) => Results.Created("/Persons/1", new
{
Id = 1,
person.Name,
person.Age,
person.Emails
}))
.WithDescription("사람을 생성합니다.")
.WithOpenApi();

app.Run();

static void InterceptNullSetter(JsonTypeInfo typeInfo)
Expand Down

0 comments on commit 0280a2f

Please sign in to comment.