I'm using swagger to test my ASP.NET Core Web API project controller's method. Swagger sees all my end points and lets me call them without issue. Swagger returns the number of records expected either one or many and all the field names are correct, but all are missing the data.
All my controllers are returning JObjects or in case of GetAll() - `System.Collections.Generic.IEnumerable<Newtonsoft.Json.Linq.JObject>.
The Agency table contains two records. Here is what Swagger displays:
[
{
"agency_name": [],
"agency_url": [],
"agency_timezone": [],
"agency_lang": [],
"agency_phone": [],
"agencyID": [],
"Divisions": []
},
{
"agency_name": [],
"agency_url": [],
"agency_timezone": [],
"agency_lang": [],
"agency_phone": [],
"agencyID": [],
"Divisions": []
}
]
It doesn't matter if I return 1 record or many.
I have set a break point at the last "return" line of the controller method, and it shows that data is being returned. Yet it is not showing in the Swagger UI.
I feel like I have left out an obvious step. Perhaps in the Program class?
Any guidance will be appreciated.
Erick.