Skip to content

Commit

Permalink
openapi 3.1.0: remove propertyNames from the generated json
Browse files Browse the repository at this point in the history
  • Loading branch information
chaen committed Nov 25, 2024
1 parent 8e828b2 commit bc22576
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
4 changes: 4 additions & 0 deletions diracx-routers/src/diracx/routers/fastapi_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ def _downgrade_openapi_schema(data):
data |= v[0]
elif k == "const":
data.pop(k)
# https://github.com/fastapi/fastapi/discussions/12984
elif k == "propertyNames":
data.pop(k)

_downgrade_openapi_schema(v)
if isinstance(data, list):
for v in data:
Expand Down
19 changes: 18 additions & 1 deletion diracx-routers/src/diracx/routers/job_manager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,10 +773,27 @@ async def get_single_job_status(
return {job_id: status}


EXAMPLE_SINGLE_JOB_STATUS = {
"Single Job Status": {
"summary": "Set single job status",
"description": "Send status for the job",
"value": {
"status": {
"2024-11-22T16:02:25.541624+00:00": {"Status": "Running"},
"2024-11-22T17:02:25.541624+00:00": {"Status": "Killed"},
}
},
},
}


@router.patch("/{job_id}/status")
async def set_single_job_status(
job_id: int,
status: Annotated[dict[datetime, JobStatusUpdate], Body()],
status: Annotated[
dict[datetime, JobStatusUpdate],
Body(openapi_examples=EXAMPLE_SINGLE_JOB_STATUS),
],
job_db: JobDB,
job_logging_db: JobLoggingDB,
check_permissions: CheckWMSPolicyCallable,
Expand Down

0 comments on commit bc22576

Please sign in to comment.