package
1.1.3
Repository: https://github.com/accelbyte/go-restful.git
Documentation: pkg.go.dev

# README

How to use Swagger UI with go-restful

Get the Swagger UI sources (version 1.2 only)

git clone https://github.com/wordnik/swagger-ui.git

The project contains a "dist" folder. Its contents has all the Swagger UI files you need.

The index.html has an url set to http://petstore.swagger.wordnik.com/api/api-docs. You need to change that to match your WebService JSON endpoint e.g. http://localhost:8080/apidocs.json

Now, you can install the Swagger WebService for serving the Swagger specification in JSON.

config := swagger.Config{
	WebServices:    restful.RegisteredWebServices(),
	ApiPath:        "/apidocs.json",
	SwaggerPath:     "/apidocs/",
	SwaggerFilePath: "/Users/emicklei/Projects/swagger-ui/dist"}
swagger.InstallSwaggerService(config)		

Notes

  • Use RouteBuilder.Operation(..) to set the Nickname field of the API spec
  • The WebServices field of swagger.Config can be used to control which service you want to expose and document ; you can have multiple configs and therefore multiple endpoints.
  • Use tag "description" to annotate a struct field with a description to show in the UI

# Functions

InstallSwaggerService add the WebService that provides the API documentation of all services conform the Swagger documentation specifcation.
RegisterSwaggerService add the WebService that provides the API documentation of all services conform the Swagger documentation specifcation.

# Variables

LogInfo is the function that is called when this package needs to log.

# Structs

5.2.2 API Object.
5.2 API Declaration.
5.1.5.
5.1.9 Authorization Code Object.
No description provided by the author
4.3.3 Data Type Fields.
5.1.7.
5.1.8 Implicit Object.
5.1.3 Info Object.
4.3.4 Items Object.
5.1.10 Login Endpoint Object.
5.2.6, 5.2.7 Models Object.
5.2.8 Properties Object.
5.2.3 Operation Object.
5.2.4 Parameter Object.
5.1.2 Resource Object.
5.1 Resource Listing.
5.2.5 Response Message Object.
5.1.6, 5.2.11.
No description provided by the author
5.1.12 Token Endpoint Object.
5.1.11 Token Request Endpoint Object.

# Type aliases

5.2.10.
No description provided by the author
No description provided by the author
No description provided by the author