diff --git a/openapi.json b/openapi.json index a470bdfe..567c64d3 100644 --- a/openapi.json +++ b/openapi.json @@ -2265,14 +2265,14 @@ ] } }, - "/instruments":{ + "/instruments/":{ "get":{ "tags":[ "instruments" ], "summary":"Instrument Query", "description":"Returns the list of instruments, inside specific project(s).", - "operationId":"instrument_query_instruments_get", + "operationId":"instrument_query_instruments__get", "parameters":[ { "description":"String containing the list of one or more project id separated by non-num char.", @@ -2293,7 +2293,7 @@ "content":{ "application/json":{ "schema":{ - "title":"Response Instrument Query Instruments Get", + "title":"Response Instrument Query Instruments Get", "type":"array", "items":{ "type":"string" @@ -3184,14 +3184,14 @@ ] } }, - "/object_set":{ + "/object_set/":{ "delete":{ "tags":[ "objects" ], "summary":"Erase Object Set", "description":"**Delete the objects with given object ids.** \n\n**Returns** the number of : **deleted objects**, 0, **deleated image rows** and **deleated image files**.\n\nšŸ”’ Current user needs *Manage* right on all projects of specified objects.", - "operationId":"erase_object_set_object_set_delete", + "operationId":"erase_object_set_object_set__delete", "parameters":[ { "description":"The list of object ids.", @@ -4029,14 +4029,14 @@ ] } }, - "/jobs":{ + "/jobs/":{ "get":{ "tags":[ "jobs" ], "summary":"List Jobs", "description":"**Return the jobs** for current user, or all of them if admin is asked for.", - "operationId":"list_jobs_jobs_get", + "operationId":"list_jobs_jobs__get", "parameters":[ { "description":"If FALSE return the jobs for current user, else return all of them.", @@ -4057,7 +4057,7 @@ "content":{ "application/json":{ "schema":{ - "title":"Response List Jobs Jobs Get", + "title":"Response List Jobs Jobs Get", "type":"array", "items":{ "$ref":"#/components/schemas/JobModel" @@ -4084,14 +4084,14 @@ ] } }, - "/jobs/{job_id}":{ + "/jobs/{job_id}/":{ "get":{ "tags":[ "jobs" ], "summary":"Get Job", "description":"Returns **information about the job** corresponding to the given id.", - "operationId":"get_job_jobs__job_id__get", + "operationId":"get_job_jobs__job_id___get", "parameters":[ { "description":"Internal, the unique numeric id of this job.", @@ -4133,14 +4133,16 @@ "BearerOrCookieAuth":[] } ] - }, - "delete":{ + } + }, + "/jobs/{job_id}/answer":{ + "post":{ "tags":[ "jobs" ], - "summary":"Erase Job", - "description":"**Delete the job** from DB, with associated storage.\n\nIf the job is running then kill it.\n\nšŸ”’ The job must be accessible to current user.", - "operationId":"erase_job_jobs__job_id__delete", + "summary":"Reply Job Question", + "description":"**Send answers to last question.** The job resumes after it receives the reply.\n\nReturn **NULL upon success.**\n\n*Note: It's only about data storage here.*\n\n\nIf the data is technically NOK e.g. not a JS object, standard 422 error should be thrown.\n\nIf the data is incorrect from consistency point of view, the job will return in Asking state.", + "operationId":"reply_job_question_jobs__job_id__answer_post", "parameters":[ { "description":"Internal, the unique numeric id of this job.", @@ -4155,12 +4157,24 @@ "in":"path" } ], + "requestBody":{ + "content":{ + "application/json":{ + "schema":{ + "title":"#TODO JCE Reply Model", + "type":"object", + "default":{} + } + } + } + }, "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ - "schema":{} + "schema":{}, + "example":{} } } }, @@ -4182,14 +4196,14 @@ ] } }, - "/jobs/{job_id}/answer":{ - "post":{ + "/jobs/{job_id}/restart":{ + "get":{ "tags":[ "jobs" ], - "summary":"Reply Job Question", - "description":"**Send answers to last question.** The job resumes after it receives the reply.\n\nReturn **NULL upon success.**\n\n*Note: It's only about data storage here.*\n\n\nIf the data is technically NOK e.g. not a JS object, standard 422 error should be thrown.\n\nIf the data is incorrect from consistency point of view, the job will return in Asking state.", - "operationId":"reply_job_question_jobs__job_id__answer_post", + "summary":"Restart Job", + "description":"**Restart the job related to the given id.**\n\nReturn **NULL upon success.**\n\nšŸ”’ The job must be in a restartable state, and be accessible to current user.", + "operationId":"restart_job_jobs__job_id__restart_get", "parameters":[ { "description":"Internal, the unique numeric id of this job.", @@ -4204,17 +4218,6 @@ "in":"path" } ], - "requestBody":{ - "content":{ - "application/json":{ - "schema":{ - "title":"#TODO JCE Reply Model", - "type":"object", - "default":{} - } - } - } - }, "responses":{ "200":{ "description":"Successful Response", @@ -4243,14 +4246,14 @@ ] } }, - "/jobs/{job_id}/restart":{ + "/jobs/{job_id}/log":{ "get":{ "tags":[ "jobs" ], - "summary":"Restart Job", - "description":"**Restart the job related to the given id.**\n\nReturn **NULL upon success.**\n\nšŸ”’ The job must be in a restartable state, and be accessible to current user.", - "operationId":"restart_job_jobs__job_id__restart_get", + "summary":"Get Job Log File", + "description":"**Return the log file produced by given job.**\n\nšŸ”’ The job must be accessible to current user.", + "operationId":"get_job_log_file_jobs__job_id__log_get", "parameters":[ { "description":"Internal, the unique numeric id of this job.", @@ -4270,8 +4273,7 @@ "description":"Successful Response", "content":{ "application/json":{ - "schema":{}, - "example":{} + "schema":{} } } }, @@ -4293,14 +4295,14 @@ ] } }, - "/jobs/{job_id}/log":{ + "/jobs/{job_id}/file":{ "get":{ "tags":[ "jobs" ], - "summary":"Get Job Log File", - "description":"**Return the log file produced by given job.**\n\nšŸ”’ The job must be accessible to current user.", - "operationId":"get_job_log_file_jobs__job_id__log_get", + "summary":"Get Job File", + "description":"**Return the file produced by given job.**\n\nšŸ”’ The job must be accessible to current user.", + "operationId":"get_job_file_jobs__job_id__file_get", "parameters":[ { "description":"Internal, the unique numeric id of this job.", @@ -4317,11 +4319,13 @@ ], "responses":{ "200":{ - "description":"Successful Response", + "description":"Return the produced file.", "content":{ "application/json":{ "schema":{} - } + }, + "application/zip":{}, + "text/tab-separated-values":{} } }, "422":{ @@ -4342,14 +4346,14 @@ ] } }, - "/jobs/{job_id}/file":{ - "get":{ + "/jobs/{job_id}":{ + "delete":{ "tags":[ "jobs" ], - "summary":"Get Job File", - "description":"**Return the file produced by given job.**\n\nšŸ”’ The job must be accessible to current user.", - "operationId":"get_job_file_jobs__job_id__file_get", + "summary":"Erase Job", + "description":"**Delete the job** from DB, with associated storage.\n\nIf the job is running then kill it.\n\nšŸ”’ The job must be accessible to current user.", + "operationId":"erase_job_jobs__job_id__delete", "parameters":[ { "description":"Internal, the unique numeric id of this job.", @@ -4366,13 +4370,11 @@ ], "responses":{ "200":{ - "description":"Return the produced file.", + "description":"Successful Response", "content":{ "application/json":{ "schema":{} - }, - "application/zip":{}, - "text/tab-separated-values":{} + } } }, "422":{ @@ -4441,19 +4443,19 @@ ] } }, - "/my_files":{ + "/my_files/":{ "post":{ "tags":[ "Files" ], "summary":"Put User File", "description":"**Upload a file for the current user.**\n\nThe returned text will contain a serve-side path which is usable for some file-related operations.\n\n*e.g. import.*", - "operationId":"put_user_file_my_files_post", + "operationId":"put_user_file_my_files__post", "requestBody":{ "content":{ "multipart/form-data":{ "schema":{ - "$ref":"#/components/schemas/Body_put_user_file_my_files_post" + "$ref":"#/components/schemas/Body_put_user_file_my_files__post" } } }, @@ -4465,7 +4467,7 @@ "content":{ "application/json":{ "schema":{ - "title":"Response Put User File My Files Post", + "title":"Response Put User File My Files Post", "type":"string" } } @@ -4489,14 +4491,14 @@ ] } }, - "/common_files":{ + "/common_files/":{ "get":{ "tags":[ "Files" ], "summary":"List Common Files", "description":"**List the common files** which are usable for some file-related operations.\n\n*e.g. import.*", - "operationId":"list_common_files_common_files_get", + "operationId":"list_common_files_common_files__get", "parameters":[ { "required":true, @@ -4725,8 +4727,8 @@ } } }, - "Body_put_user_file_my_files_post":{ - "title":"Body_put_user_file_my_files_post", + "Body_put_user_file_my_files__post":{ + "title":"Body_put_user_file_my_files__post", "required":[ "file" ], diff --git a/py/main.py b/py/main.py index 509690bd..941c67f5 100644 --- a/py/main.py +++ b/py/main.py @@ -1028,7 +1028,7 @@ def acquisition_query( # ######################## END OF ACQUISITION -@app.get("/instruments", +@app.get("/instruments/", tags=['instruments'], response_model=List[str], responses={ @@ -1407,7 +1407,7 @@ def compute_project_cnn(proj_id: int = Path(..., description="Internal, numeric rsp = sce.run(current_user, proj_id) return rsp -@app.delete("/object_set", tags=['objects'], +@app.delete("/object_set/", tags=['objects'], responses={ 200: { "content": { @@ -1837,7 +1837,7 @@ def machine_learning_train(project_id: int = Query(..., title="Input project #", # ######################## END OF ADMIN -@app.get("/jobs", tags=['jobs'], response_model=List[JobModel]) +@app.get("/jobs/", tags=['jobs'], response_model=List[JobModel]) def list_jobs(for_admin: bool = Query(..., title="For admin", description="If FALSE return the jobs for current user, else return all of them.", example=False), @@ -1851,7 +1851,7 @@ def list_jobs(for_admin: bool = Query(..., title="For admin", return ret -@app.get("/jobs/{job_id}", tags=['jobs'], response_model=JobModel) +@app.get("/jobs/{job_id}/", tags=['jobs'], response_model=JobModel) def get_job(job_id: int = Path(..., description="Internal, the unique numeric id of this job.", example=47445), current_user: int = Depends(get_current_user)) -> JobBO: """ @@ -1988,7 +1988,7 @@ async def list_user_files(sub_path: str = Query(..., title="Sub path", descripti return file_list -@app.post("/my_files", tags=['Files'], response_model=str) +@app.post("/my_files/", tags=['Files'], response_model=str) async def put_user_file(file: UploadFile = File(...), path: Optional[str] = Form(None), tag: Optional[str] = Form(None), @@ -2006,7 +2006,7 @@ async def put_user_file(file: UploadFile = File(...), return file_name #TODO JCE - description example -@app.get("/common_files", tags=['Files'], response_model=DirectoryModel) +@app.get("/common_files/", tags=['Files'], response_model=DirectoryModel) async def list_common_files(path: str = Query(..., title="path", description="", example=""), current_user: int = Depends(get_current_user)) -> DirectoryModel: """