API's Collection Return Type
See original GitHub issueCurrently the .NET API returns a List<T>
for API calls that return a collection such as the Pipeline.ViewPipelineAsync
method. Do you think this should be changed to something like IList<T>
instead to mirror what was done for collections inside of the objects that are returned like Loan.CustomFields
?
I suppose semantically it doesn’t matter as we’re unlikely to need to change the return type but the cohesiveness with the object’s collections seems beneficial. Thoughts?
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
what is the best collection type to return in an API
As I generally only return immutable (unmodifiable) objects from properties/methods, this answer assumes you want to do the same.
Read more >Web API Return Types in ASP.NET Core
In this article, we are going to learn about different return types that we can use with ASP.NET Core Web API controller actions....
Read more >Controller action return types in ASP.NET Core web API
The ActionResult types represent various HTTP status codes. Any non-abstract class deriving from ActionResult qualifies as a valid return type.
Read more >The Web API action method can have following return types.
An action method can return primitive or other custom complex types as other normal methods. Consider the following Get action methods. Example: Primitive...
Read more >Collection (Java Platform SE 8 )
Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
changing my vote to List<>
The thing is the deserializer
Json.NET
is already creating aList<T>
so why not just expose it as such. See here. Then we’ll have aCount
property and users will know they’re able to modify the collection as it’s created just for their call.