Skip to content
This repository was archived by the owner on Dec 18, 2020. It is now read-only.

SwaggerGen Annotation Usage

William Gardiner edited this page Mar 21, 2019 · 1 revision

Fields

  • url
  • method
  • description
  • headers
  • queryParams
  • body
  • responses
  • responseBody
  • scheme

url

Type: String The endpoint path. URL parameters should be enclosed in curly braces '{', '}'. (e.g. /path/to/target/{target_id}).

method

Type: String (enum) Values:

  • GET
  • PUT
  • POST
  • DELETE

description

Type: String Description of the method.

headers

Type: Array of Strings Item format: [type] [header_name]=[header_description] A list of headers and their descriptions.

queryParams

Type: Array of Strings Item format: [type] [parameter_name]=[parameter_description] A list of query parameters and their descriptions.

body

Type: String (filename) The name of the JSON Schema file defining the input.

responses

Type: Array of Integers List of response codes

responseBody

Type: String (filename) The name of the JSON Schema file defining the expected output.

scheme

Type: String (enum) Values:

  • HTTP
  • HTTPS

Example

@SwaggerGen(
	url="/base/endpoint",
	method="POST",
	description="Serverlet Description",
	headers={"Content-Type=application/json"},
	queryParams={
		"i param = An Integer Param", 
		"b param2 = A Boolean Param", 
		"s64 param3 = A String Param",
		"param4 = Another String Param"
	},
	body="body.scheme",
	responses={200, 400, 404},
	responseBody= "response.scheme",
	scheme="HTTP"
)

Clone this wiki locally