1
1
mirror of https://github.com/go-gitea/gitea synced 2025-01-08 08:54:27 +00:00

docs: set up project files for swagger documentation

This commit is contained in:
eyad-hussein 2024-07-14 16:50:32 +03:00
parent 10c0766a77
commit 9ca2cdfa39
4 changed files with 47 additions and 0 deletions

View File

@ -22,6 +22,7 @@ type Project struct {
}
type CreateProjectOption struct {
// required:true
Title string `json:"title" binding:"Required;MaxSize(100)"`
Content string `json:"content"`
TemplateType uint8 `json:"template_type"`

View File

@ -41,6 +41,34 @@ func ProjectHandler(model string, fn func(ctx *context.APIContext, model string)
// CreateProject creates a new project
func CreateProject(ctx *context.APIContext, model string) {
// swagger: operation POST /users/{username}/{reponame}/projects project createProject
// ---
// summary: Create a project
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: username
// in: path
// description: owner of the project
// type: string
// required: true
// - name: reponame
// in: path
// description: repository name
// type: string
// required: true
// - name: body
// in: body
// schema:
// "$ref": "#/definitions/CreateProjectOption"
// responses:
// "200":
// "$ref": "#/responses/Project"
// "404":
// "$ref": "#/responses/notFound"
err := checkModelType(model)
if err != nil {

View File

@ -205,4 +205,7 @@ type swaggerParameterBodies struct {
// in:body
UpdateVariableOption api.UpdateVariableOption
// in:body
CreateProjectOption api.CreateProjectOption
}

View File

@ -0,0 +1,15 @@
// Copyright 2017 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package swagger
import (
api "code.gitea.io/gitea/modules/structs"
)
// Project
// swagger:response Project
type swaggerResponseProject struct {
// in:body
Body api.Project `json:"body"`
}