diff --git a/api/handler/tag.go b/api/handler/tag.go index 53a10ebc..16689e50 100644 --- a/api/handler/tag.go +++ b/api/handler/tag.go @@ -99,7 +99,7 @@ func (t *TagsHandler) CreateTag(ctx *gin.Context) { // @Success 200 {object} types.Response{database.Tag} "OK" // @Failure 400 {object} types.APIBadRequest "Bad request" // @Failure 500 {object} types.APIInternalServerError "Internal server error" -// @Router /tag/{id} [get] +// @Router /tags/{id} [get] func (t *TagsHandler) GetTagByID(ctx *gin.Context) { userName := httpbase.GetCurrentUser(ctx) if userName == "" { @@ -133,7 +133,7 @@ func (t *TagsHandler) GetTagByID(ctx *gin.Context) { // @Success 200 {object} types.Response{database.Tag} "OK" // @Failure 400 {object} types.APIBadRequest "Bad request" // @Failure 500 {object} types.APIInternalServerError "Internal server error" -// @Router /tag/{id} [put] +// @Router /tags/{id} [put] func (t *TagsHandler) UpdateTag(ctx *gin.Context) { userName := httpbase.GetCurrentUser(ctx) if userName == "" { @@ -172,7 +172,7 @@ func (t *TagsHandler) UpdateTag(ctx *gin.Context) { // @Success 200 {object} types.Response{} "OK" // @Failure 400 {object} types.APIBadRequest "Bad request" // @Failure 500 {object} types.APIInternalServerError "Internal server error" -// @Router /tag/{id} [delete] +// @Router /tags/{id} [delete] func (t *TagsHandler) DeleteTag(ctx *gin.Context) { userName := httpbase.GetCurrentUser(ctx) if userName == "" { diff --git a/docs/docs.go b/docs/docs.go index 4fe703f2..b2611626 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -10022,14 +10022,14 @@ const docTemplate = `{ } } }, - "/tag/{id}": { + "/tags": { "get": { "security": [ { "ApiKey": [] } ], - "description": "Get a tag by id", + "description": "Get all tags", "consumes": [ "application/json" ], @@ -10039,21 +10039,45 @@ const docTemplate = `{ "tags": [ "Tag" ], - "summary": "Get a tag by id", + "summary": "Get all tags", "parameters": [ { "type": "string", - "description": "id of the tag", - "name": "id", - "in": "path", - "required": true + "description": "category name", + "name": "category", + "in": "query" + }, + { + "enum": [ + "model", + "dataset" + ], + "type": "string", + "description": "scope name", + "name": "scope", + "in": "query" } ], "responses": { "200": { - "description": "OK", + "description": "tags", "schema": { - "$ref": "#/definitions/types.Response" + "allOf": [ + { + "$ref": "#/definitions/types.ResponseWithTotal" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/database.Tag" + } + } + } + } + ] } }, "400": { @@ -10070,13 +10094,13 @@ const docTemplate = `{ } } }, - "put": { + "post": { "security": [ { "ApiKey": [] } ], - "description": "Update a tag by id", + "description": "Create new tag", "consumes": [ "application/json" ], @@ -10086,22 +10110,15 @@ const docTemplate = `{ "tags": [ "Tag" ], - "summary": "Update a tag by id", + "summary": "Create new tag", "parameters": [ - { - "type": "string", - "description": "id of the tag", - "name": "id", - "in": "path", - "required": true - }, { "description": "body", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/types.UpdateTag" + "$ref": "#/definitions/types.CreateTag" } } ], @@ -10125,14 +10142,16 @@ const docTemplate = `{ } } } - }, - "delete": { + } + }, + "/tags/{id}": { + "get": { "security": [ { "ApiKey": [] } ], - "description": "Delete a tag by id", + "description": "Get a tag by id", "consumes": [ "application/json" ], @@ -10142,7 +10161,7 @@ const docTemplate = `{ "tags": [ "Tag" ], - "summary": "Delete a tag by id", + "summary": "Get a tag by id", "parameters": [ { "type": "string", @@ -10172,16 +10191,14 @@ const docTemplate = `{ } } } - } - }, - "/tags": { - "get": { + }, + "put": { "security": [ { "ApiKey": [] } ], - "description": "Get all tags", + "description": "Update a tag by id", "consumes": [ "application/json" ], @@ -10191,45 +10208,30 @@ const docTemplate = `{ "tags": [ "Tag" ], - "summary": "Get all tags", + "summary": "Update a tag by id", "parameters": [ { "type": "string", - "description": "category name", - "name": "category", - "in": "query" + "description": "id of the tag", + "name": "id", + "in": "path", + "required": true }, { - "enum": [ - "model", - "dataset" - ], - "type": "string", - "description": "scope name", - "name": "scope", - "in": "query" + "description": "body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/types.UpdateTag" + } } ], "responses": { "200": { - "description": "tags", + "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/types.ResponseWithTotal" - }, - { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/database.Tag" - } - } - } - } - ] + "$ref": "#/definitions/types.Response" } }, "400": { @@ -10246,13 +10248,13 @@ const docTemplate = `{ } } }, - "post": { + "delete": { "security": [ { "ApiKey": [] } ], - "description": "Create new tag", + "description": "Delete a tag by id", "consumes": [ "application/json" ], @@ -10262,16 +10264,14 @@ const docTemplate = `{ "tags": [ "Tag" ], - "summary": "Create new tag", + "summary": "Delete a tag by id", "parameters": [ { - "description": "body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/types.CreateTag" - } + "type": "string", + "description": "id of the tag", + "name": "id", + "in": "path", + "required": true } ], "responses": { diff --git a/docs/swagger.json b/docs/swagger.json index b0e864e6..196b34e1 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -10011,14 +10011,14 @@ } } }, - "/tag/{id}": { + "/tags": { "get": { "security": [ { "ApiKey": [] } ], - "description": "Get a tag by id", + "description": "Get all tags", "consumes": [ "application/json" ], @@ -10028,21 +10028,45 @@ "tags": [ "Tag" ], - "summary": "Get a tag by id", + "summary": "Get all tags", "parameters": [ { "type": "string", - "description": "id of the tag", - "name": "id", - "in": "path", - "required": true + "description": "category name", + "name": "category", + "in": "query" + }, + { + "enum": [ + "model", + "dataset" + ], + "type": "string", + "description": "scope name", + "name": "scope", + "in": "query" } ], "responses": { "200": { - "description": "OK", + "description": "tags", "schema": { - "$ref": "#/definitions/types.Response" + "allOf": [ + { + "$ref": "#/definitions/types.ResponseWithTotal" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/database.Tag" + } + } + } + } + ] } }, "400": { @@ -10059,13 +10083,13 @@ } } }, - "put": { + "post": { "security": [ { "ApiKey": [] } ], - "description": "Update a tag by id", + "description": "Create new tag", "consumes": [ "application/json" ], @@ -10075,22 +10099,15 @@ "tags": [ "Tag" ], - "summary": "Update a tag by id", + "summary": "Create new tag", "parameters": [ - { - "type": "string", - "description": "id of the tag", - "name": "id", - "in": "path", - "required": true - }, { "description": "body", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/types.UpdateTag" + "$ref": "#/definitions/types.CreateTag" } } ], @@ -10114,14 +10131,16 @@ } } } - }, - "delete": { + } + }, + "/tags/{id}": { + "get": { "security": [ { "ApiKey": [] } ], - "description": "Delete a tag by id", + "description": "Get a tag by id", "consumes": [ "application/json" ], @@ -10131,7 +10150,7 @@ "tags": [ "Tag" ], - "summary": "Delete a tag by id", + "summary": "Get a tag by id", "parameters": [ { "type": "string", @@ -10161,16 +10180,14 @@ } } } - } - }, - "/tags": { - "get": { + }, + "put": { "security": [ { "ApiKey": [] } ], - "description": "Get all tags", + "description": "Update a tag by id", "consumes": [ "application/json" ], @@ -10180,45 +10197,30 @@ "tags": [ "Tag" ], - "summary": "Get all tags", + "summary": "Update a tag by id", "parameters": [ { "type": "string", - "description": "category name", - "name": "category", - "in": "query" + "description": "id of the tag", + "name": "id", + "in": "path", + "required": true }, { - "enum": [ - "model", - "dataset" - ], - "type": "string", - "description": "scope name", - "name": "scope", - "in": "query" + "description": "body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/types.UpdateTag" + } } ], "responses": { "200": { - "description": "tags", + "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/types.ResponseWithTotal" - }, - { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/database.Tag" - } - } - } - } - ] + "$ref": "#/definitions/types.Response" } }, "400": { @@ -10235,13 +10237,13 @@ } } }, - "post": { + "delete": { "security": [ { "ApiKey": [] } ], - "description": "Create new tag", + "description": "Delete a tag by id", "consumes": [ "application/json" ], @@ -10251,16 +10253,14 @@ "tags": [ "Tag" ], - "summary": "Create new tag", + "summary": "Delete a tag by id", "parameters": [ { - "description": "body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/types.CreateTag" - } + "type": "string", + "description": "id of the tag", + "name": "id", + "in": "path", + "required": true } ], "responses": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 4ba5c8dc..1209dabb 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -10515,24 +10515,37 @@ paths: summary: Get latest version tags: - Sync - /tag/{id}: - delete: + /tags: + get: consumes: - application/json - description: Delete a tag by id + description: Get all tags parameters: - - description: id of the tag - in: path - name: id - required: true + - description: category name + in: query + name: category + type: string + - description: scope name + enum: + - model + - dataset + in: query + name: scope type: string produces: - application/json responses: "200": - description: OK + description: tags schema: - $ref: '#/definitions/types.Response' + allOf: + - $ref: '#/definitions/types.ResponseWithTotal' + - properties: + data: + items: + $ref: '#/definitions/database.Tag' + type: array + type: object "400": description: Bad request schema: @@ -10543,19 +10556,20 @@ paths: $ref: '#/definitions/types.APIInternalServerError' security: - ApiKey: [] - summary: Delete a tag by id + summary: Get all tags tags: - Tag - get: + post: consumes: - application/json - description: Get a tag by id + description: Create new tag parameters: - - description: id of the tag - in: path - name: id + - description: body + in: body + name: body required: true - type: string + schema: + $ref: '#/definitions/types.CreateTag' produces: - application/json responses: @@ -10573,25 +10587,20 @@ paths: $ref: '#/definitions/types.APIInternalServerError' security: - ApiKey: [] - summary: Get a tag by id + summary: Create new tag tags: - Tag - put: + /tags/{id}: + delete: consumes: - application/json - description: Update a tag by id + description: Delete a tag by id parameters: - description: id of the tag in: path name: id required: true type: string - - description: body - in: body - name: body - required: true - schema: - $ref: '#/definitions/types.UpdateTag' produces: - application/json responses: @@ -10609,40 +10618,26 @@ paths: $ref: '#/definitions/types.APIInternalServerError' security: - ApiKey: [] - summary: Update a tag by id + summary: Delete a tag by id tags: - Tag - /tags: get: consumes: - application/json - description: Get all tags + description: Get a tag by id parameters: - - description: category name - in: query - name: category - type: string - - description: scope name - enum: - - model - - dataset - in: query - name: scope + - description: id of the tag + in: path + name: id + required: true type: string produces: - application/json responses: "200": - description: tags + description: OK schema: - allOf: - - $ref: '#/definitions/types.ResponseWithTotal' - - properties: - data: - items: - $ref: '#/definitions/database.Tag' - type: array - type: object + $ref: '#/definitions/types.Response' "400": description: Bad request schema: @@ -10653,20 +10648,25 @@ paths: $ref: '#/definitions/types.APIInternalServerError' security: - ApiKey: [] - summary: Get all tags + summary: Get a tag by id tags: - Tag - post: + put: consumes: - application/json - description: Create new tag + description: Update a tag by id parameters: + - description: id of the tag + in: path + name: id + required: true + type: string - description: body in: body name: body required: true schema: - $ref: '#/definitions/types.CreateTag' + $ref: '#/definitions/types.UpdateTag' produces: - application/json responses: @@ -10684,7 +10684,7 @@ paths: $ref: '#/definitions/types.APIInternalServerError' security: - ApiKey: [] - summary: Create new tag + summary: Update a tag by id tags: - Tag /telemetry/usage: