From 581df31df4dc4410870a0589d29378ed7ad83c35 Mon Sep 17 00:00:00 2001 From: Lyuyang Hu Date: Tue, 10 May 2022 14:25:24 -0400 Subject: [PATCH] feat: extract post systems props to a separate class --- backend/src/impl/default_controllers_impl.py | 4 ++-- openapi/openapi.yaml | 21 +++++++++++--------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/backend/src/impl/default_controllers_impl.py b/backend/src/impl/default_controllers_impl.py index 34584eb7..531de5d6 100644 --- a/backend/src/impl/default_controllers_impl.py +++ b/backend/src/impl/default_controllers_impl.py @@ -26,10 +26,10 @@ from explainaboard_web.models.datasets_return import DatasetsReturn from explainaboard_web.models.system import System from explainaboard_web.models.system_analyses_return import SystemAnalysesReturn +from explainaboard_web.models.system_create_props import SystemCreateProps from explainaboard_web.models.system_info import SystemInfo from explainaboard_web.models.system_outputs_return import SystemOutputsReturn from explainaboard_web.models.systems_analyses_body import SystemsAnalysesBody -from explainaboard_web.models.systems_body import SystemsBody from explainaboard_web.models.systems_return import SystemsReturn from explainaboard_web.models.task import Task from explainaboard_web.models.task_category import TaskCategory @@ -146,7 +146,7 @@ def systems_get( ) -def systems_post(body: SystemsBody) -> System: +def systems_post(body: SystemCreateProps) -> System: """ aborts with error if fails TODO: error handling diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index a9098534..fb5c7e5f 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -231,15 +231,7 @@ paths: content: application/json: schema: - type: object - properties: - metadata: - $ref: "#/components/schemas/SystemCreateProps" - system_output: - $ref: "#/components/schemas/SystemOutputProps" - custom_dataset: - $ref: "#/components/schemas/SystemOutputProps" - required: [metadata, system_output] + $ref: "#/components/schemas/SystemCreateProps" responses: "200": description: OK @@ -651,6 +643,17 @@ components: required: [task_metadata_id, task_name] SystemCreateProps: + type: object + properties: + metadata: + $ref: "#/components/schemas/SystemMetadata" + system_output: + $ref: "#/components/schemas/SystemOutputProps" + custom_dataset: + $ref: "#/components/schemas/SystemOutputProps" + required: [metadata, system_output] + + SystemMetadata: type: object properties: task: