mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 03:18:24 +00:00 
			
		
		
		
	docs: set up project files for swagger documentation
This commit is contained in:
		| @@ -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"` | ||||
|   | ||||
| @@ -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 { | ||||
|   | ||||
| @@ -205,4 +205,7 @@ type swaggerParameterBodies struct { | ||||
|  | ||||
| 	// in:body | ||||
| 	UpdateVariableOption api.UpdateVariableOption | ||||
|  | ||||
| 	// in:body | ||||
| 	CreateProjectOption api.CreateProjectOption | ||||
| } | ||||
|   | ||||
							
								
								
									
										15
									
								
								routers/api/v1/swagger/project.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								routers/api/v1/swagger/project.go
									
									
									
									
									
										Normal 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"` | ||||
| } | ||||
		Reference in New Issue
	
	Block a user