Skip to content

Commit

Permalink
feat: Initial autogenerated FastAPI implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Drew Meyers committed Sep 3, 2024
1 parent 30efac8 commit cbf62b1
Showing 1 changed file with 27 additions and 23 deletions.
50 changes: 27 additions & 23 deletions app-cp/src/openapi_server/impl/processes_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,37 +99,41 @@ def execute(
) -> Execute200Response:
check_process_integrity(self.db, processId, new_process=False)
# Fetch process description
process_description = self.get_process_description(processId)
# process_description = self.get_process_description(processId)

# Validate inputs against schema
validated_inputs = {}
for input_id, input_value in execute_workflows.inputs.items():
input_description = next(
(input for input in process_description.inputs if input.id == input_id),
None,
)
if input_description is None:
raise HTTPException(
status_code=fastapi_status.HTTP_400_BAD_REQUEST,
detail=f"Invalid input: {input_id}",
)

# try:
# #validate(instance=input_value.value, schema=input_description.schema_)
# validated_inputs[input_id] = input_value.value
# except ValidationError as e:
# raise HTTPException(
# status_code=fastapi_status.HTTP_400_BAD_REQUEST,
# detail=f"Invalid input for {input_id}: {e.message}",
# )
validated_inputs[input_id] = input_value.value
# validated_inputs = {}
# for input_id, input_value in execute_workflows.inputs.items():
# input_description = next(
# (input for input in process_description.inputs if input.id == input_id),
# None,
# )
# if input_description is None:
# raise HTTPException(
# status_code=fastapi_status.HTTP_400_BAD_REQUEST,
# detail=f"Invalid input: {input_id}",
# )

# try:
# #validate(instance=input_value.value, schema=input_description.schema_)
# validated_inputs[input_id] = input_value.value
# except ValidationError as e:
# raise HTTPException(
# status_code=fastapi_status.HTTP_400_BAD_REQUEST,
# detail=f"Invalid input for {input_id}: {e.message}",
# )
# validated_inputs[input_id] = input_value.value

job_id = str(uuid.uuid4())
logical_date = datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%fZ")
data = {
"dag_run_id": job_id,
"logical_date": logical_date,
"conf": validated_inputs,
"conf": (
execute_workflows.inputs.model_dump()
if execute_workflows.inputs
else {}
),
}

try:
Expand Down

0 comments on commit cbf62b1

Please sign in to comment.