Skip to content

Commit

Permalink
also response model
Browse files Browse the repository at this point in the history
  • Loading branch information
masci committed Feb 13, 2024
1 parent 1f1773a commit 9ac7284
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/hayhooks/server/utils/deploy_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def deploy_pipeline_def(app, pipeline_def: PipelineDefinition):
except ValueError as e:
raise HTTPException(status_code=409, detail=f"{e}") from e

config = ConfigDict(arbitrary_types_allowed=True)

request_model = {}
for component_name, inputs in pipe.inputs().items():
# Inputs have this form:
Expand All @@ -26,7 +28,6 @@ def deploy_pipeline_def(app, pipeline_def: PipelineDefinition):
# },
# 'second_addition': {'add': {'type': typing.Optional[int], 'is_mandatory': False}},
# }
config = ConfigDict(arbitrary_types_allowed=True)
component_model = {}
for name, typedef in inputs.items():
component_model[name] = (typedef["type"], typedef.get("default_value", ...))
Expand All @@ -45,7 +46,7 @@ def deploy_pipeline_def(app, pipeline_def: PipelineDefinition):
component_model = {}
for name, typedef in outputs.items():
component_model[name] = (typedef["type"], ...)
response_model[component_name] = (create_model('ComponentParams', **component_model), ...)
response_model[component_name] = (create_model('ComponentParams', **component_model, __config__=config), ...)

PipelineRunResponse = create_model(f'{pipeline_def.name.capitalize()}RunResponse', **response_model)

Expand Down

0 comments on commit 9ac7284

Please sign in to comment.