How to enable swagger in ServiceStack?

I found mention of swagger in the opening slides. But nowhere else. Is this still not over?

Edit: Apparently this is on the to-do list.

Is there a good way to document RestAPI automatically?

+7
source share
5 answers

According to Trello , it was "Doing", but was then ported to "To Do"; and there is the Swagger.Api module in the github repository, so it is assumed that it is only partially completed.

Edit

As already stated (but for completeness, since that was the accepted answer), SwaggerUI is ready for the service (and the holy moth is awesome). The Github wiki has been filled in the last few days, and it is very easy to get it and run it.

+4
source

To enable Swagger for your service stack, go to the Swagger API page on the service wiki page.

Detailed steps:

  • Run Install-Package ServiceStack.Api.Swagger in the package manager console.
  • Enable the Swagger plugin in AppHost.cs with:

     using ServiceStack.Api.Swagger; public override void Configure(Container container) { ... Plugins.Add(new SwaggerFeature()); ... } 
  • Swagger access interface with http://localhost:port/swagger-ui/index.html

+8
source

It looks like it's ready and ready now, see the release notes for v3.9.35 @ https://github.com/ServiceStack/ServiceStack/wiki/Release-Notes

+3
source

Hmm ... sorry if I misunderstood this:

Is there a good way to document RestAPI automatically?

... but when I decorate my DTO or service with attributes, this is:

 [Route("/hello","GET")] [Route("/hello/{Name}","POST,GET")] public class Hello : IReturn<HelloResponse> { public string Name { get; set; } } 

The default metadata page generated by the servicestack service describes usage:

enter image description here

Isn't that what you are looking for?

+1
source

Since I use .Net Core ServiceStack, so I installed ServiceStack.Api.Swagger.Core nuget for Swagger UI.

But that gave me a "500: vague error."

Then I uninstalled ServiceStack.Api.Swagger.Core and installed ServiceStack.Api.Swagger.

This works great.

0
source

All Articles