Skip to content

Commit

Permalink
fix randomness in openapi-spec generation in webserver
Browse files Browse the repository at this point in the history
  • Loading branch information
bisgaard-itis committed Dec 3, 2024
1 parent b8d4d38 commit 7dc7b11
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions api/specs/web-server/_projects_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,35 +34,35 @@
)


def to_desc(exceptions: set[type[Exception]] | type[Exception]):
exc_classes = {exceptions} if not isinstance(exceptions, set) else exceptions
def to_desc(exceptions: list[type[Exception]] | type[Exception]):
exc_classes = [exceptions] if not isinstance(exceptions, list) else exceptions
return ", ".join(f"{cls.__name__}" for cls in exc_classes)


@router.post(
"/projects/{project_id}:open",
response_model=Envelope[ProjectGet],
responses={
status.HTTP_400_BAD_REQUEST: {"description": to_desc({ValidationError})},
status.HTTP_400_BAD_REQUEST: {"description": to_desc([ValidationError])},
status.HTTP_402_PAYMENT_REQUIRED: {
"description": to_desc({WalletNotEnoughCreditsError})
"description": to_desc([WalletNotEnoughCreditsError])
},
status.HTTP_403_FORBIDDEN: {
"description": to_desc({ProjectInvalidRightsError})
"description": to_desc([ProjectInvalidRightsError])
},
status.HTTP_404_NOT_FOUND: {
"description": to_desc(
{ProjectNotFoundError, UserDefaultWalletNotFoundError}
[ProjectNotFoundError, UserDefaultWalletNotFoundError]
)
},
status.HTTP_409_CONFLICT: {
"description": to_desc({ProjectTooManyProjectOpenedError}),
"description": to_desc([ProjectTooManyProjectOpenedError]),
},
status.HTTP_422_UNPROCESSABLE_ENTITY: {
"description": to_desc({ValidationError})
"description": to_desc([ValidationError])
},
status.HTTP_503_SERVICE_UNAVAILABLE: {
"description": to_desc({DirectorServiceError})
"description": to_desc([DirectorServiceError])
},
},
)
Expand Down

0 comments on commit 7dc7b11

Please sign in to comment.