From 25999d9b69f3762720151b07b10da9e014dbc87e Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 21 Mar 2019 07:40:56 +0100 Subject: [PATCH] Fixed swagger docs for task labels --- pkg/models/label_task.go | 6 ++--- pkg/swagger/docs.go | 47 +++++++++++++++++++++++++--------------- pkg/swagger/swagger.json | 45 ++++++++++++++++++++++++-------------- pkg/swagger/swagger.yaml | 43 +++++++++++++++++++++--------------- 4 files changed, 88 insertions(+), 53 deletions(-) diff --git a/pkg/models/label_task.go b/pkg/models/label_task.go index 84f0d83eddf..f716f760898 100644 --- a/pkg/models/label_task.go +++ b/pkg/models/label_task.go @@ -49,7 +49,7 @@ func (LabelTask) TableName() string { // @Security JWTKeyAuth // @Param task path int true "Task 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 404 {object} code.vikunja.io/web.HTTPError "Label not found." // @Failure 500 {object} models.Message "Internal error" @@ -67,8 +67,8 @@ func (lt *LabelTask) Delete() (err error) { // @Produce json // @Security JWTKeyAuth // @Param task path int true "Task ID" -// @Param label body models.Label true "The label object" -// @Success 200 {object} models.Label "The created label relation object." +// @Param label body models.LabelTask true "The label object" +// @Success 200 {object} models.LabelTask "The created label relation object." // @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 404 {object} code.vikunja.io/web.HTTPError "The label does not exist." diff --git a/pkg/swagger/docs.go b/pkg/swagger/docs.go index 1331f791253..384846a7b8e 100644 --- a/pkg/swagger/docs.go +++ b/pkg/swagger/docs.go @@ -1,6 +1,6 @@ // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // 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 @@ -37,7 +37,7 @@ var doc = `{ "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": [ "application/json" ], @@ -45,9 +45,9 @@ var doc = `{ "application/json" ], "tags": [ - "labels" + "assignees" ], - "summary": "Get all labels a user has access to", + "summary": "Get all assignees for a task", "parameters": [ { "type": "integer", @@ -57,18 +57,18 @@ var doc = `{ }, { "type": "string", - "description": "Search labels by label text.", + "description": "Search assignees by their username.", "name": "s", "in": "query" } ], "responses": { "200": { - "description": "The labels", + "description": "The assignees", "schema": { "type": "array", "items": { - "$ref": "#/definitions/models.Label" + "$ref": "#/definitions/models.User" } } }, @@ -391,7 +391,7 @@ var doc = `{ "JWTKeyAuth": [] } ], - "description": "Returns a team by its ID.", + "description": "Returns a list by its ID.", "consumes": [ "application/json" ], @@ -399,13 +399,13 @@ var doc = `{ "application/json" ], "tags": [ - "team" + "list" ], - "summary": "Gets one team", + "summary": "Gets one list", "parameters": [ { "type": "integer", - "description": "Team ID", + "description": "List ID", "name": "id", "in": "path", "required": true @@ -413,14 +413,14 @@ var doc = `{ ], "responses": { "200": { - "description": "The team", + "description": "The list", "schema": { "type": "object", - "$ref": "#/definitions/models.Team" + "$ref": "#/definitions/models.List" } }, "403": { - "description": "The user does not have access to the team", + "description": "The user does not have access to the list", "schema": { "type": "object", "$ref": "#/definitions/code.vikunja.io.web.HTTPError" @@ -2870,7 +2870,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/models.Label" + "$ref": "#/definitions/models.LabelTask" } } ], @@ -2879,7 +2879,7 @@ var doc = `{ "description": "The created label relation object.", "schema": { "type": "object", - "$ref": "#/definitions/models.Label" + "$ref": "#/definitions/models.LabelTask" } }, "400": { @@ -2952,7 +2952,7 @@ var doc = `{ "description": "The label was successfully removed.", "schema": { "type": "object", - "$ref": "#/definitions/models.Label" + "$ref": "#/definitions/models.Message" } }, "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": { "type": "object", "properties": { diff --git a/pkg/swagger/swagger.json b/pkg/swagger/swagger.json index 46e4b59b34b..0cbabc4ef68 100644 --- a/pkg/swagger/swagger.json +++ b/pkg/swagger/swagger.json @@ -24,7 +24,7 @@ "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": [ "application/json" ], @@ -32,9 +32,9 @@ "application/json" ], "tags": [ - "labels" + "assignees" ], - "summary": "Get all labels a user has access to", + "summary": "Get all assignees for a task", "parameters": [ { "type": "integer", @@ -44,18 +44,18 @@ }, { "type": "string", - "description": "Search labels by label text.", + "description": "Search assignees by their username.", "name": "s", "in": "query" } ], "responses": { "200": { - "description": "The labels", + "description": "The assignees", "schema": { "type": "array", "items": { - "$ref": "#/definitions/models.Label" + "$ref": "#/definitions/models.User" } } }, @@ -378,7 +378,7 @@ "JWTKeyAuth": [] } ], - "description": "Returns a team by its ID.", + "description": "Returns a list by its ID.", "consumes": [ "application/json" ], @@ -386,13 +386,13 @@ "application/json" ], "tags": [ - "team" + "list" ], - "summary": "Gets one team", + "summary": "Gets one list", "parameters": [ { "type": "integer", - "description": "Team ID", + "description": "List ID", "name": "id", "in": "path", "required": true @@ -400,14 +400,14 @@ ], "responses": { "200": { - "description": "The team", + "description": "The list", "schema": { "type": "object", - "$ref": "#/definitions/models.Team" + "$ref": "#/definitions/models.List" } }, "403": { - "description": "The user does not have access to the team", + "description": "The user does not have access to the list", "schema": { "type": "object", "$ref": "#/definitions/code.vikunja.io/web.HTTPError" @@ -2857,7 +2857,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/models.Label" + "$ref": "#/definitions/models.LabelTask" } } ], @@ -2866,7 +2866,7 @@ "description": "The created label relation object.", "schema": { "type": "object", - "$ref": "#/definitions/models.Label" + "$ref": "#/definitions/models.LabelTask" } }, "400": { @@ -2939,7 +2939,7 @@ "description": "The label was successfully removed.", "schema": { "type": "object", - "$ref": "#/definitions/models.Label" + "$ref": "#/definitions/models.Message" } }, "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": { "type": "object", "properties": { diff --git a/pkg/swagger/swagger.yaml b/pkg/swagger/swagger.yaml index 2b24473199a..82a13963fd6 100644 --- a/pkg/swagger/swagger.yaml +++ b/pkg/swagger/swagger.yaml @@ -144,6 +144,16 @@ definitions: change this value. type: integer 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: properties: labels: @@ -639,15 +649,14 @@ paths: get: consumes: - application/json - 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. parameters: - description: The page number. Used for pagination. If not provided, the first page of results is returned. in: query name: p type: integer - - description: Search labels by label text. + - description: Search assignees by their username. in: query name: s type: string @@ -655,10 +664,10 @@ paths: - application/json responses: "200": - description: The labels + description: The assignees schema: items: - $ref: '#/definitions/models.Label' + $ref: '#/definitions/models.User' type: array "500": description: Internal error @@ -667,9 +676,9 @@ paths: type: object security: - JWTKeyAuth: [] - summary: Get all labels a user has access to + summary: Get all assignees for a task tags: - - labels + - assignees put: consumes: - application/json @@ -913,9 +922,9 @@ paths: get: consumes: - application/json - description: Returns a team by its ID. + description: Returns a list by its ID. parameters: - - description: Team ID + - description: List ID in: path name: id required: true @@ -924,12 +933,12 @@ paths: - application/json responses: "200": - description: The team + description: The list schema: - $ref: '#/definitions/models.Team' + $ref: '#/definitions/models.List' type: object "403": - description: The user does not have access to the team + description: The user does not have access to the list schema: $ref: '#/definitions/code.vikunja.io/web.HTTPError' type: object @@ -940,9 +949,9 @@ paths: type: object security: - JWTKeyAuth: [] - summary: Gets one team + summary: Gets one list tags: - - team + - list post: consumes: - application/json @@ -2272,7 +2281,7 @@ paths: name: label required: true schema: - $ref: '#/definitions/models.Label' + $ref: '#/definitions/models.LabelTask' type: object produces: - application/json @@ -2280,7 +2289,7 @@ paths: "200": description: The created label relation object. schema: - $ref: '#/definitions/models.Label' + $ref: '#/definitions/models.LabelTask' type: object "400": description: Invalid label object provided. @@ -2330,7 +2339,7 @@ paths: "200": description: The label was successfully removed. schema: - $ref: '#/definitions/models.Label' + $ref: '#/definitions/models.Message' type: object "403": description: Not allowed to remove the label.