-
-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
json array request body binding for inherited
IEnumerable<T>
reques…
…t DTOs #436
- Loading branch information
1 parent
189ed42
commit d7e082e
Showing
10 changed files
with
276 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
Web/[Features]/TestCases/JsonArrayBindingToIEnumerableDto/Endpoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace TestCases.JsonArrayBindingToIEnumerableDto; | ||
|
||
public class Endpoint : Endpoint<Request, List<Response>> | ||
{ | ||
public override void Configure() | ||
{ | ||
Post("/test-cases/json-array-binding-to-ienumerable-dto"); | ||
AllowAnonymous(); | ||
} | ||
|
||
public override Task HandleAsync(Request r, CancellationToken c) | ||
{ | ||
Response = r.Select(x => new Response { Id = x.Id, Name = x.Name }).ToList(); | ||
return Task.CompletedTask; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
Web/[Features]/TestCases/JsonArrayBindingToIEnumerableDto/Models.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace TestCases.JsonArrayBindingToIEnumerableDto; | ||
|
||
public sealed class Request : List<Item> | ||
{ | ||
} | ||
|
||
public class Item | ||
{ | ||
public int Id { get; set; } | ||
public string Name { get; set; } | ||
} | ||
|
||
public class Response : Item | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ public class Request | |
|
||
public class Response : Request | ||
{ | ||
public int Id { get; set; } | ||
} |