X
X
xmdv2020-12-28 23:38:36
ASP.NET
xmdv, 2020-12-28 23:38:36

What is the correct way to use Swagger in Blazor server side?

I would like to use Swagger in a Blazor server-side application. About the topic is that Swagger generates json by default for public methods of controllers. But my application doesn't really use any controllers, but instead passes data from the server to the client using custom C# classes. Is it possible to somehow force Swagger to generate json from the public methods of these classes, just like it is done for controllers?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2020-12-29
@vabka

You can independently parse your classes through reflection and generate json in the desired format.
NSwag and Swashbucle don't know anything about the semantics of your custom classes, so "teaching" them won't be much easier than doing it yourself.
https://swagger.io/specification/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question