I have a .NET 5.0 ASP.NET Core project and I am using Nswag to generate an API client.
Let's say I have the following API model:
public class GetFooListResponseModel
{
public string Bar { get; set; }
}
What I would like is 2 things. Let's start with the basic one.
- How do I make the generated API Client's model name a different one than the one in my project? For example, I want the generated typescript model to be called
Fooinstead ofGetFooListResponseModel. - Could I make them have different names based on the client it is generating? For example, for my C# Client I am completely fine with the existing model name, but the typescript one needs to be changed. If this is not possible it's no big deal, but it would be nice.
Thank you very much!
You can simply create a injectable service called 'FooService' for communicating with backend services using HTTP Request. Specify the model/class (you can create any name you want) being returned from your API in
getFooListResponse(). The naming not necessary must be the same withGetFooListResponseModel, as long the attributes and its data type of the model/class are same.foo.service.ts
foo.model.ts