Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable swagger in ServiceStack?

I found mention of swagger in the Introductory Slides. But nowhere else. Is is something not finished yet?

Edit: Apparently it's on To Do List.

Is there any good way to document the RestAPI automatically?

like image 382
Kugel Avatar asked Dec 28 '12 13:12

Kugel


People also ask

What is swagger in Visual Studio?

Swagger (OpenAPI) is a language-agnostic specification for describing REST APIs. It allows both computers and humans to understand the capabilities of a REST API without direct access to the source code. Its main goals are to: Minimize the amount of work needed to connect decoupled services.


1 Answers

To enable Swagger for your Service Stack, follow the Swagger API page on Service Stack wiki.

Detailed Steps:

  1. Run Install-Package ServiceStack.Api.Swagger in your package manager console.
  2. Enable Swagger plugin in your AppHost.cs with:

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

like image 101
Gan Avatar answered Oct 28 '22 14:10

Gan