Fixed swagger docs for task labels

This commit is contained in:
kolaente 2019-03-21 07:40:56 +01:00
parent eb4d38b5b8
commit 25999d9b69
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
4 changed files with 88 additions and 53 deletions

View File

@ -49,7 +49,7 @@ func (LabelTask) TableName() string {
// @Security JWTKeyAuth // @Security JWTKeyAuth
// @Param task path int true "Task ID" // @Param task path int true "Task ID"
// @Param label path int true "Label ID" // @Param label path int true "Label ID"
// @Success 200 {object} models.Label "The label was successfully removed." // @Success 200 {object} models.Message "The label was successfully removed."
// @Failure 403 {object} code.vikunja.io/web.HTTPError "Not allowed to remove the label." // @Failure 403 {object} code.vikunja.io/web.HTTPError "Not allowed to remove the label."
// @Failure 404 {object} code.vikunja.io/web.HTTPError "Label not found." // @Failure 404 {object} code.vikunja.io/web.HTTPError "Label not found."
// @Failure 500 {object} models.Message "Internal error" // @Failure 500 {object} models.Message "Internal error"
@ -67,8 +67,8 @@ func (lt *LabelTask) Delete() (err error) {
// @Produce json // @Produce json
// @Security JWTKeyAuth // @Security JWTKeyAuth
// @Param task path int true "Task ID" // @Param task path int true "Task ID"
// @Param label body models.Label true "The label object" // @Param label body models.LabelTask true "The label object"
// @Success 200 {object} models.Label "The created label relation object." // @Success 200 {object} models.LabelTask "The created label relation object."
// @Failure 400 {object} code.vikunja.io/web.HTTPError "Invalid label object provided." // @Failure 400 {object} code.vikunja.io/web.HTTPError "Invalid label object provided."
// @Failure 403 {object} code.vikunja.io/web.HTTPError "Not allowed to add the label." // @Failure 403 {object} code.vikunja.io/web.HTTPError "Not allowed to add the label."
// @Failure 404 {object} code.vikunja.io/web.HTTPError "The label does not exist." // @Failure 404 {object} code.vikunja.io/web.HTTPError "The label does not exist."

View File

@ -1,6 +1,6 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at // This file was generated by swaggo/swag at
// 2019-03-08 15:41:16.787899662 +0100 CET m=+0.154547316 // 2019-03-21 07:40:14.605699742 +0100 CET m=+0.177681498
package swagger package swagger
@ -37,7 +37,7 @@ var doc = `{
"JWTKeyAuth": [] "JWTKeyAuth": []
} }
], ],
"description": "Returns all labels which are either created by the user or associated with a task the user has at least read-access to.", "description": "Returns an array with all assignees for this task.",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
@ -45,9 +45,9 @@ var doc = `{
"application/json" "application/json"
], ],
"tags": [ "tags": [
"labels" "assignees"
], ],
"summary": "Get all labels a user has access to", "summary": "Get all assignees for a task",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
@ -57,18 +57,18 @@ var doc = `{
}, },
{ {
"type": "string", "type": "string",
"description": "Search labels by label text.", "description": "Search assignees by their username.",
"name": "s", "name": "s",
"in": "query" "in": "query"
} }
], ],
"responses": { "responses": {
"200": { "200": {
"description": "The labels", "description": "The assignees",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/models.Label" "$ref": "#/definitions/models.User"
} }
} }
}, },
@ -391,7 +391,7 @@ var doc = `{
"JWTKeyAuth": [] "JWTKeyAuth": []
} }
], ],
"description": "Returns a team by its ID.", "description": "Returns a list by its ID.",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
@ -399,13 +399,13 @@ var doc = `{
"application/json" "application/json"
], ],
"tags": [ "tags": [
"team" "list"
], ],
"summary": "Gets one team", "summary": "Gets one list",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
"description": "Team ID", "description": "List ID",
"name": "id", "name": "id",
"in": "path", "in": "path",
"required": true "required": true
@ -413,14 +413,14 @@ var doc = `{
], ],
"responses": { "responses": {
"200": { "200": {
"description": "The team", "description": "The list",
"schema": { "schema": {
"type": "object", "type": "object",
"$ref": "#/definitions/models.Team" "$ref": "#/definitions/models.List"
} }
}, },
"403": { "403": {
"description": "The user does not have access to the team", "description": "The user does not have access to the list",
"schema": { "schema": {
"type": "object", "type": "object",
"$ref": "#/definitions/code.vikunja.io.web.HTTPError" "$ref": "#/definitions/code.vikunja.io.web.HTTPError"
@ -2870,7 +2870,7 @@ var doc = `{
"required": true, "required": true,
"schema": { "schema": {
"type": "object", "type": "object",
"$ref": "#/definitions/models.Label" "$ref": "#/definitions/models.LabelTask"
} }
} }
], ],
@ -2879,7 +2879,7 @@ var doc = `{
"description": "The created label relation object.", "description": "The created label relation object.",
"schema": { "schema": {
"type": "object", "type": "object",
"$ref": "#/definitions/models.Label" "$ref": "#/definitions/models.LabelTask"
} }
}, },
"400": { "400": {
@ -2952,7 +2952,7 @@ var doc = `{
"description": "The label was successfully removed.", "description": "The label was successfully removed.",
"schema": { "schema": {
"type": "object", "type": "object",
"$ref": "#/definitions/models.Label" "$ref": "#/definitions/models.Message"
} }
}, },
"403": { "403": {
@ -3803,6 +3803,19 @@ var doc = `{
} }
} }
}, },
"models.LabelTask": {
"type": "object",
"properties": {
"created": {
"description": "A unix timestamp when this task was created. You cannot change this value.",
"type": "integer"
},
"label_id": {
"description": "The label id you want to associate with a task.",
"type": "integer"
}
}
},
"models.LabelTaskBulk": { "models.LabelTaskBulk": {
"type": "object", "type": "object",
"properties": { "properties": {

View File

@ -24,7 +24,7 @@
"JWTKeyAuth": [] "JWTKeyAuth": []
} }
], ],
"description": "Returns all labels which are either created by the user or associated with a task the user has at least read-access to.", "description": "Returns an array with all assignees for this task.",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
@ -32,9 +32,9 @@
"application/json" "application/json"
], ],
"tags": [ "tags": [
"labels" "assignees"
], ],
"summary": "Get all labels a user has access to", "summary": "Get all assignees for a task",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
@ -44,18 +44,18 @@
}, },
{ {
"type": "string", "type": "string",
"description": "Search labels by label text.", "description": "Search assignees by their username.",
"name": "s", "name": "s",
"in": "query" "in": "query"
} }
], ],
"responses": { "responses": {
"200": { "200": {
"description": "The labels", "description": "The assignees",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/models.Label" "$ref": "#/definitions/models.User"
} }
} }
}, },
@ -378,7 +378,7 @@
"JWTKeyAuth": [] "JWTKeyAuth": []
} }
], ],
"description": "Returns a team by its ID.", "description": "Returns a list by its ID.",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
@ -386,13 +386,13 @@
"application/json" "application/json"
], ],
"tags": [ "tags": [
"team" "list"
], ],
"summary": "Gets one team", "summary": "Gets one list",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
"description": "Team ID", "description": "List ID",
"name": "id", "name": "id",
"in": "path", "in": "path",
"required": true "required": true
@ -400,14 +400,14 @@
], ],
"responses": { "responses": {
"200": { "200": {
"description": "The team", "description": "The list",
"schema": { "schema": {
"type": "object", "type": "object",
"$ref": "#/definitions/models.Team" "$ref": "#/definitions/models.List"
} }
}, },
"403": { "403": {
"description": "The user does not have access to the team", "description": "The user does not have access to the list",
"schema": { "schema": {
"type": "object", "type": "object",
"$ref": "#/definitions/code.vikunja.io/web.HTTPError" "$ref": "#/definitions/code.vikunja.io/web.HTTPError"
@ -2857,7 +2857,7 @@
"required": true, "required": true,
"schema": { "schema": {
"type": "object", "type": "object",
"$ref": "#/definitions/models.Label" "$ref": "#/definitions/models.LabelTask"
} }
} }
], ],
@ -2866,7 +2866,7 @@
"description": "The created label relation object.", "description": "The created label relation object.",
"schema": { "schema": {
"type": "object", "type": "object",
"$ref": "#/definitions/models.Label" "$ref": "#/definitions/models.LabelTask"
} }
}, },
"400": { "400": {
@ -2939,7 +2939,7 @@
"description": "The label was successfully removed.", "description": "The label was successfully removed.",
"schema": { "schema": {
"type": "object", "type": "object",
"$ref": "#/definitions/models.Label" "$ref": "#/definitions/models.Message"
} }
}, },
"403": { "403": {
@ -3789,6 +3789,19 @@
} }
} }
}, },
"models.LabelTask": {
"type": "object",
"properties": {
"created": {
"description": "A unix timestamp when this task was created. You cannot change this value.",
"type": "integer"
},
"label_id": {
"description": "The label id you want to associate with a task.",
"type": "integer"
}
}
},
"models.LabelTaskBulk": { "models.LabelTaskBulk": {
"type": "object", "type": "object",
"properties": { "properties": {

View File

@ -144,6 +144,16 @@ definitions:
change this value. change this value.
type: integer type: integer
type: object type: object
models.LabelTask:
properties:
created:
description: A unix timestamp when this task was created. You cannot change
this value.
type: integer
label_id:
description: The label id you want to associate with a task.
type: integer
type: object
models.LabelTaskBulk: models.LabelTaskBulk:
properties: properties:
labels: labels:
@ -639,15 +649,14 @@ paths:
get: get:
consumes: consumes:
- application/json - application/json
description: Returns all labels which are either created by the user or associated description: Returns an array with all assignees for this task.
with a task the user has at least read-access to.
parameters: parameters:
- description: The page number. Used for pagination. If not provided, the first - description: The page number. Used for pagination. If not provided, the first
page of results is returned. page of results is returned.
in: query in: query
name: p name: p
type: integer type: integer
- description: Search labels by label text. - description: Search assignees by their username.
in: query in: query
name: s name: s
type: string type: string
@ -655,10 +664,10 @@ paths:
- application/json - application/json
responses: responses:
"200": "200":
description: The labels description: The assignees
schema: schema:
items: items:
$ref: '#/definitions/models.Label' $ref: '#/definitions/models.User'
type: array type: array
"500": "500":
description: Internal error description: Internal error
@ -667,9 +676,9 @@ paths:
type: object type: object
security: security:
- JWTKeyAuth: [] - JWTKeyAuth: []
summary: Get all labels a user has access to summary: Get all assignees for a task
tags: tags:
- labels - assignees
put: put:
consumes: consumes:
- application/json - application/json
@ -913,9 +922,9 @@ paths:
get: get:
consumes: consumes:
- application/json - application/json
description: Returns a team by its ID. description: Returns a list by its ID.
parameters: parameters:
- description: Team ID - description: List ID
in: path in: path
name: id name: id
required: true required: true
@ -924,12 +933,12 @@ paths:
- application/json - application/json
responses: responses:
"200": "200":
description: The team description: The list
schema: schema:
$ref: '#/definitions/models.Team' $ref: '#/definitions/models.List'
type: object type: object
"403": "403":
description: The user does not have access to the team description: The user does not have access to the list
schema: schema:
$ref: '#/definitions/code.vikunja.io/web.HTTPError' $ref: '#/definitions/code.vikunja.io/web.HTTPError'
type: object type: object
@ -940,9 +949,9 @@ paths:
type: object type: object
security: security:
- JWTKeyAuth: [] - JWTKeyAuth: []
summary: Gets one team summary: Gets one list
tags: tags:
- team - list
post: post:
consumes: consumes:
- application/json - application/json
@ -2272,7 +2281,7 @@ paths:
name: label name: label
required: true required: true
schema: schema:
$ref: '#/definitions/models.Label' $ref: '#/definitions/models.LabelTask'
type: object type: object
produces: produces:
- application/json - application/json
@ -2280,7 +2289,7 @@ paths:
"200": "200":
description: The created label relation object. description: The created label relation object.
schema: schema:
$ref: '#/definitions/models.Label' $ref: '#/definitions/models.LabelTask'
type: object type: object
"400": "400":
description: Invalid label object provided. description: Invalid label object provided.
@ -2330,7 +2339,7 @@ paths:
"200": "200":
description: The label was successfully removed. description: The label was successfully removed.
schema: schema:
$ref: '#/definitions/models.Label' $ref: '#/definitions/models.Message'
type: object type: object
"403": "403":
description: Not allowed to remove the label. description: Not allowed to remove the label.