mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 10:56:10 +01:00 
			
		
		
		
	Validate migration files (#18203)
JSON Schema validation for data used by Gitea during migrations Discussion at https://forum.forgefriends.org/t/common-json-schema-for-repository-information/563 Co-authored-by: Loïc Dachary <loic@dachary.org>
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							49dd906753
						
					
				
				
					commit
					3bb028cc46
				
			| @@ -17,24 +17,26 @@ import ( | ||||
|  | ||||
| // RestoreParams structure holds a data for restore repository | ||||
| type RestoreParams struct { | ||||
| 	RepoDir   string | ||||
| 	OwnerName string | ||||
| 	RepoName  string | ||||
| 	Units     []string | ||||
| 	RepoDir    string | ||||
| 	OwnerName  string | ||||
| 	RepoName   string | ||||
| 	Units      []string | ||||
| 	Validation bool | ||||
| } | ||||
|  | ||||
| // RestoreRepo calls the internal RestoreRepo function | ||||
| func RestoreRepo(ctx context.Context, repoDir, ownerName, repoName string, units []string) (int, string) { | ||||
| func RestoreRepo(ctx context.Context, repoDir, ownerName, repoName string, units []string, validation bool) (int, string) { | ||||
| 	reqURL := setting.LocalURL + "api/internal/restore_repo" | ||||
|  | ||||
| 	req := newInternalRequest(ctx, reqURL, "POST") | ||||
| 	req.SetTimeout(3*time.Second, 0) // since the request will spend much time, don't timeout | ||||
| 	req = req.Header("Content-Type", "application/json") | ||||
| 	jsonBytes, _ := json.Marshal(RestoreParams{ | ||||
| 		RepoDir:   repoDir, | ||||
| 		OwnerName: ownerName, | ||||
| 		RepoName:  repoName, | ||||
| 		Units:     units, | ||||
| 		RepoDir:    repoDir, | ||||
| 		OwnerName:  ownerName, | ||||
| 		RepoName:   repoName, | ||||
| 		Units:      units, | ||||
| 		Validation: validation, | ||||
| 	}) | ||||
| 	req.Body(jsonBytes) | ||||
| 	resp, err := req.Response() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user