Mohammed Nafees před 3 roky
rodič
revize
780daf7675

+ 7 - 3
api/server/handlers/environment/validate_porter_yaml.go

@@ -92,7 +92,7 @@ func (c *ValidatePorterYAMLHandler) ServeHTTP(w http.ResponseWriter, r *http.Req
 	)
 
 	if ghResp.StatusCode == 404 {
-		res.Errors = append(res.Errors, preview.ErrNoPorterYAMLFile)
+		res.Errors = append(res.Errors, preview.ErrNoPorterYAMLFile.Error())
 		c.WriteResult(w, r, res)
 		return
 	}
@@ -110,12 +110,16 @@ func (c *ValidatePorterYAMLHandler) ServeHTTP(w http.ResponseWriter, r *http.Req
 	}
 
 	if contents == "" {
-		res.Errors = append(res.Errors, preview.ErrEmptyPorterYAMLFile)
+		res.Errors = append(res.Errors, preview.ErrEmptyPorterYAMLFile.Error())
 		c.WriteResult(w, r, res)
 		return
 	}
 
-	res.Errors = append(res.Errors, preview.Validate(contents)...)
+	for _, err := range preview.Validate(contents) {
+		if err != nil {
+			res.Errors = append(res.Errors, err.Error())
+		}
+	}
 
 	c.WriteResult(w, r, res)
 }

+ 1 - 1
api/types/environment.go

@@ -135,5 +135,5 @@ type ValidatePorterYAMLRequest struct {
 }
 
 type ValidatePorterYAMLResponse struct {
-	Errors []error `json:"errors"`
+	Errors []string `json:"errors"`
 }