Skip to content

Commit

Permalink
[backend][OAS] modify resource properties naming according to style g…
Browse files Browse the repository at this point in the history
…uide.
  • Loading branch information
katsujukou committed Nov 12, 2024
1 parent 249ee06 commit aacff1e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 22 deletions.
3 changes: 2 additions & 1 deletion backend/oas/user/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,8 @@ components:
result:
type: string
description: The result of quantum computation, set only if the computation is successful.
example: '{ "11": 4980, "00": 5020 }'
example: |
{ "11": 4980, "00": 5020 }
reason:
type: string
description: The reason indicating why there is no result
Expand Down
48 changes: 28 additions & 20 deletions backend/oas/user/schemas/jobs.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
jobs.JobId:
type: string
example: "7af020f6-2e38-4d70-8cf0-4349650ea08c"
example: 7af020f6-2e38-4d70-8cf0-4349650ea08c

jobs.GetJobStatusResponse:
description: job status
Expand Down Expand Up @@ -29,7 +29,8 @@ jobs.JobInfoSampling:
properties:
job_type:
type: string
enum: ["sampling"]
enum:
- sampling
code:
type: string
example: >-
Expand All @@ -51,7 +52,7 @@ jobs.JobInfoEstimation:
job_type:
type: string
enum:
- "estimation"
- estimation
code:
type: string
example: >-
Expand All @@ -63,7 +64,7 @@ jobs.JobInfoEstimation:
c = measure q;
operator:
type: string
example: "X 0 Y 1 Z 5 I 2"
example: X 0 Y 1 Z 5 I 2
required:
- job_type
- code
Expand Down Expand Up @@ -92,17 +93,24 @@ jobs.JobInfo:
result:
type: string
description: "The result of quantum computation, set only if the computation is successful."
example: '{ "11": 4980, "00": 5020 }'
example: |
{ "11": 4980, "00": 5020 }
reason:
type: string
description: "The reason indicating why there is no result"
description: The reason indicating why there is no result
required:
- desc

jobs.JobStatus:
type: string
enum: ["submitted", "ready", "running", "success", "failed", "cancelled"]
example: "submitted"
enum:
- submitted
- ready
- running
- success
- failed
- cancelled
example: submitted

jobs.TranspilerInfo:
type: string
Expand Down Expand Up @@ -141,9 +149,9 @@ jobs.MitigationInfo:
jobs.JobType:
type: string
enum:
- "estimation"
- "sampling"
example: "sampling"
- estimation
- sampling
example: sampling

jobs.JobDef:
type: object
Expand All @@ -152,10 +160,10 @@ jobs.JobDef:
$ref: "#/jobs.JobId"
name:
type: string
example: "Bell State Sampling"
example: Bell State Sampling
description:
type: string
example: "Bell State Sampling Example"
example: Bell State Sampling Example
job_type:
$ref: "#/jobs.JobType"
status:
Expand All @@ -179,11 +187,11 @@ jobs.JobDef:
created_at:
type: string
format: date-time
example: "2022-10-19T11:45:34Z"
example: 2022-10-19T11:45:34Z
updated_at:
type: string
format: date-time
example: "2022-10-19T11:45:34Z"
example: 2022-10-19T11:45:34Z
required:
- job_id
- name
Expand Down Expand Up @@ -213,22 +221,22 @@ jobs.JobDef:
{ "ro_error_mitigation": "pseudo_inverse" }
shots: 1000
status: submitted
created_at: "2022-10-19T11:45:34"
updated_at: "2022-10-19T11:45:34"
created_at: 2022-10-19T11:45:34
updated_at: 2022-10-19T11:45:34


jobs.SubmitJobRequest:
type: object
properties:
name:
type: string
example: "Bell State Sampling"
example: Bell State Sampling
description:
type: string
example: "An example of Bell state sampling job"
example: An example of Bell state sampling job
device_id:
type: string
example: "Kawasaki"
example: Kawasaki
job_info:
$ref: "#/jobs.JobInfoDesc"
transpiler_info:
Expand Down
4 changes: 3 additions & 1 deletion backend/oqtopus_cloud/user/schemas/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ class JobInfo(BaseModel):
]
),
] = None
result: Annotated[str | None, Field(examples=['{ "11": 4980, "00": 5020 }'])] = None
result: Annotated[str | None, Field(examples=['{ "11": 4980, "00": 5020 }\n'])] = (
None
)
"""
The result of quantum computation, set only if the computation is successful.
"""
Expand Down

0 comments on commit aacff1e

Please sign in to comment.