Skip to content

Commit

Permalink
error model and fixes path
Browse files Browse the repository at this point in the history
  • Loading branch information
pcrespov committed Jul 20, 2023
1 parent c9968d5 commit 69960c0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
from collections.abc import Callable
from typing import Any

from fastapi import HTTPException
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel
from starlette.requests import Request
from starlette.responses import JSONResponse


class ErrorGet(BaseModel):
# We intentionally keep it open until more restrictive policy is implemented
# Check use cases:
# - https://github.com/ITISFoundation/osparc-issues/issues/958
# - https://github.com/ITISFoundation/osparc-simcore/issues/2520
# - https://github.com/ITISFoundation/osparc-simcore/issues/2446
errors: list[Any]
from ...models.schemas.errors import ErrorGet


def create_error_json_response(*errors, status_code: int) -> JSONResponse:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@


def _create_study_from_project(project: ProjectGet) -> Study:
assert isinstance(project, ProjectGet) # nosec
return Study.construct(
uid=project.uuid,
title=project.name,
Expand All @@ -33,7 +34,7 @@ def _create_study_from_project(project: ProjectGet) -> Study:


@router.get(
"/",
"",
response_model=LimitOffsetPage[Study],
include_in_schema=API_SERVER_DEV_FEATURES_ENABLED,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from typing import Any

from pydantic import BaseModel


class ErrorGet(BaseModel):
# We intentionally keep it open until more restrictive policy is implemented
# Check use cases:
# - https://github.com/ITISFoundation/osparc-issues/issues/958
# - https://github.com/ITISFoundation/osparc-simcore/issues/2520
# - https://github.com/ITISFoundation/osparc-simcore/issues/2446
errors: list[Any]

0 comments on commit 69960c0

Please sign in to comment.