diff --git a/api/handlers.go b/api/handlers.go index 6d601f3..d93e57a 100644 --- a/api/handlers.go +++ b/api/handlers.go @@ -86,6 +86,11 @@ func openapiExport(w http.ResponseWriter, r *http.Request) { slog.Info("Accepted a new schema: %s", fullSchema.Info.Title) fullPth := "./schemas/" + fullSchema.Info.Title + ".json" + if err = os.MkdirAll(filepath.Dir(fullPth), 0777); err != nil { + slog.Error("Error creating directory %s: %v", filepath.Dir(fullPth), err) + returnError(w, err) + return + } err = os.WriteFile(fullPth, jsonData, 0644) if err != nil {