-
Notifications
You must be signed in to change notification settings - Fork 4
Action Documentation
For get action documentation you need add an action block to resource controller:
# =begin action
# =end
Documentation blocks use yaml format.
You need add parameters to action blocks that will be interpreted by rapidoc and used for generate documentation of actions.
- method
- action
- authentication_required
- response_formats
- description
- http_responses
- params
- errors
method: GET
- Type: String
- Description: method for access to acction
- Values: the most common are: GET, POST, PUT and DELETE
- Required: true
action: index
- Type: String
- Description: action called for this method + url
- Values: the most common are: index, show, create, update and destroy
- Required: true
authentication_required: true
- Type: Boolean
- Description: indicates if this action requires authentication
- Values: [true, false]
- Required: false
If you don't add this paramether, rapidoc use default value (true). For change default value see: configuration
response_formats: json, html
- Type: String
- Description: types of formats that your API support
- Values: the most commont are: json, xml and html
- Required: false
You can omit this parameter if you use default response formats. For define default response formats see: configuration
description: returns all users
- Type: String
- Description: action description
- Required: false
For multi line description use >
operator.
If you use inline description and want use the character :
you need surround description with ''
.
http_responses:
- 204
- 403
- 404
- Type: Array
- Description: http status codes that this resouece can return
- Values: the most commont are: 200, 201, 401, 404, 422...
- Required: false
params:
- name: email
description: user email
type: String
- Type: Array
- Description: all params that you can use in request
- Required: false
For more info about params see: params
params:
- object: email
message: invalid
description: invalid email format
- Type: Array
- Description: all errors that request can returns
- Required: false
For more info about errors see: errors
For complete example see the user tests controller: complete example