The answer from @ultravelocity didnt quite work for me. The error was like "'Response`1' is already used". I dont know what was the exact reason, but i guess it was something about inheritance / generics (since i returned a paged responses).
Based on the question and answer from @ultravelocity I developed a possible solution for .net 5 (maybe for asp.net core 2.c/3.d also) which tackles this problem.
Steps:
- Add customSchemaId-Strategy like @ultravelocity did
a.CustomSchemaIds(schemaIdStrategy);
- Add your custom strategy function
private static string schemaIdStrategy(Type currentClass)
{
string customSuffix = "Response";
var tmpDisplayName = currentClass.ShortDisplayName().Replace("<", "").Replace(">", "");
var removedSuffix = tmpDisplayName.EndsWith(customSuffix) ? tmpDisplayName.Substring(0, tmpDisplayName.Length - customSuffix.Length) : tmpDisplayName;
return removedSuffix;
}