Forum Discussion

nevernerd's avatar
nevernerd
Occasional Visitor
3 years ago

Swagger 2.0 differences

For the last 5 or so years we've been creating rest api clients through visual studio. We built our own .net 4.5.2 factory to use these clients. We recently upgraded to visual studio 2019, and now it's completely different with the OpenApi connected services thing. So, I updated to the latest swashbuckle.

 

I think I've been able to narrow down the failure of our client factory to this:

 

Previously, when generating using visual studio (and thus, autorest) the class for our client looked like this:

public partial class EmailClient : ServiceClient<EmailClient>, IEmailClient

 

Now, generating with Visual Studio 2019 (and thus, NSwag reading from the same swagger url) it looks like this:

public partial class EmailClient

 

Why is this different? And is there an option to get back to it? We use generics and reflection to create the client, that signature looks like this-

public T CreateClient<T>() where T : ServiceClient<T>

 

Appreciate any thoughts someone may have on this. Trying to figure out a way to go forward that doesn't involve massive updates.

 

Thanks.

No RepliesBe the first to reply