From 908e8942ccae5b7966c7084780b3441e2190d9c1 Mon Sep 17 00:00:00 2001 From: Antoine GIRARD Date: Tue, 12 Jun 2018 16:59:22 +0200 Subject: Fix swagger errors (#4220) Fix all the resting errors to have a valid swagger file. They are still some warnings but nothing blocking. Doing so I found that some request still misses son parameters for some POST/PUT/PATCH request. This means the a client generated from the swagger file will not work completely. Fix #4088 by activating validation in drone Should fix #4010. --- routers/api/v1/org/hook.go | 49 ++++++++++++++++++++++++++++++++++++++++++++++ routers/api/v1/org/team.go | 6 +++--- 2 files changed, 52 insertions(+), 3 deletions(-) (limited to 'routers/api/v1/org') diff --git a/routers/api/v1/org/hook.go b/routers/api/v1/org/hook.go index 0a77d795e6..83d2a5e5ba 100644 --- a/routers/api/v1/org/hook.go +++ b/routers/api/v1/org/hook.go @@ -20,6 +20,12 @@ func ListHooks(ctx *context.APIContext) { // summary: List an organization's webhooks // produces: // - application/json + // parameters: + // - name: org + // in: path + // description: name of the organization + // type: string + // required: true // responses: // "200": // "$ref": "#/responses/HookList" @@ -43,6 +49,17 @@ func GetHook(ctx *context.APIContext) { // summary: Get a hook // produces: // - application/json + // parameters: + // - name: org + // in: path + // description: name of the organization + // type: string + // required: true + // - name: id + // in: path + // description: id of the hook to get + // type: integer + // required: true // responses: // "200": // "$ref": "#/responses/Hook" @@ -64,9 +81,17 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) { // - application/json // produces: // - application/json + // parameters: + // - name: org + // in: path + // description: name of the organization + // type: string + // required: true // responses: // "201": // "$ref": "#/responses/Hook" + + //TODO in body params if !utils.CheckCreateHookOption(ctx, &form) { return } @@ -82,9 +107,22 @@ func EditHook(ctx *context.APIContext, form api.EditHookOption) { // - application/json // produces: // - application/json + // parameters: + // - name: org + // in: path + // description: name of the organization + // type: string + // required: true + // - name: id + // in: path + // description: id of the hook to update + // type: integer + // required: true // responses: // "200": // "$ref": "#/responses/Hook" + + //TODO in body params hookID := ctx.ParamsInt64(":id") utils.EditOrgHook(ctx, &form, hookID) } @@ -96,6 +134,17 @@ func DeleteHook(ctx *context.APIContext) { // summary: Delete a hook // produces: // - application/json + // parameters: + // - name: org + // in: path + // description: name of the organization + // type: string + // required: true + // - name: id + // in: path + // description: id of the hook to delete + // type: integer + // required: true // responses: // "204": // "$ref": "#/responses/empty" diff --git a/routers/api/v1/org/team.go b/routers/api/v1/org/team.go index 408d8921db..b8dd026bf3 100644 --- a/routers/api/v1/org/team.go +++ b/routers/api/v1/org/team.go @@ -227,7 +227,7 @@ func AddTeamMember(ctx *context.APIContext) { // RemoveTeamMember api for remove one member from a team func RemoveTeamMember(ctx *context.APIContext) { - // swagger:operation DELETE /teams/{id}/members/{username} organization orgAddTeamMember + // swagger:operation DELETE /teams/{id}/members/{username} organization orgRemoveTeamMember // --- // summary: Remove a team member // produces: @@ -306,7 +306,7 @@ func getRepositoryByParams(ctx *context.APIContext) *models.Repository { // AddTeamRepository api for adding a repository to a team func AddTeamRepository(ctx *context.APIContext) { - // swagger:operation PUT /teams/{id}/repos/{org}/{repo} organization orgAddTeamMember + // swagger:operation PUT /teams/{id}/repos/{org}/{repo} organization orgAddTeamRepository // --- // summary: Add a repository to a team // produces: @@ -350,7 +350,7 @@ func AddTeamRepository(ctx *context.APIContext) { // RemoveTeamRepository api for removing a repository from a team func RemoveTeamRepository(ctx *context.APIContext) { - // swagger:operation DELETE /teams/{id}/repos/{org}/{repo} organization orgAddTeamMember + // swagger:operation DELETE /teams/{id}/repos/{org}/{repo} organization orgRemoveTeamRepository // --- // summary: Remove a repository from a team // description: This does not delete the repository, it only removes the -- cgit v1.2.3