Skip to content

Commit

Permalink
[Tag] Update swagger doc (#216)
Browse files Browse the repository at this point in the history
Co-authored-by: Haihui.Wang <[email protected]>
  • Loading branch information
SeanHH86 and wanghh2000 authored Dec 19, 2024
1 parent c2bff3c commit bf0d012
Show file tree
Hide file tree
Showing 4 changed files with 191 additions and 191 deletions.
6 changes: 3 additions & 3 deletions api/handler/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "" {
Expand Down Expand Up @@ -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 == "" {
Expand Down Expand Up @@ -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 == "" {
Expand Down
136 changes: 68 additions & 68 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
],
Expand All @@ -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": {
Expand All @@ -10070,13 +10094,13 @@ const docTemplate = `{
}
}
},
"put": {
"post": {
"security": [
{
"ApiKey": []
}
],
"description": "Update a tag by id",
"description": "Create new tag",
"consumes": [
"application/json"
],
Expand All @@ -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"
}
}
],
Expand All @@ -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"
],
Expand All @@ -10142,7 +10161,7 @@ const docTemplate = `{
"tags": [
"Tag"
],
"summary": "Delete a tag by id",
"summary": "Get a tag by id",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -10172,16 +10191,14 @@ const docTemplate = `{
}
}
}
}
},
"/tags": {
"get": {
},
"put": {
"security": [
{
"ApiKey": []
}
],
"description": "Get all tags",
"description": "Update a tag by id",
"consumes": [
"application/json"
],
Expand All @@ -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": {
Expand All @@ -10246,13 +10248,13 @@ const docTemplate = `{
}
}
},
"post": {
"delete": {
"security": [
{
"ApiKey": []
}
],
"description": "Create new tag",
"description": "Delete a tag by id",
"consumes": [
"application/json"
],
Expand All @@ -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": {
Expand Down
Loading

0 comments on commit bf0d012

Please sign in to comment.