Clean Architecture — ASP.NET Core REST API with OData and Swagger UI
Discussing how to provide GraphQL like experience in the REST API using OData and Swagger UI.
UPDATE April 10, 2022: all projects in the GitHub repo have been upgraded to .NET 5.
This article extends the Clean Architecture — ASP.NET Core Partitioned Repository Pattern Using Azure Cosmos DB, where Clean Architecture, Database Partitioning, and Partitioned Repository Pattern are discussed.
What do you do when you have a RESTful API endpoint that returns a giant resource payload, but your client application only needs a small piece?
For example, my GET ToDoItem endpoint returns the following data by default.
What if all I really only need are the titles? Well the solution is to allow the URL: https://localhost:5001/api/ToDoItem?$select=title to return only the titles like below. You see how the payload is drastically reduced.