Skip to content

Commit

Permalink
Use EmptyModel instead of BaseModel
Browse files Browse the repository at this point in the history
Cannot call schema directly on BaseModel in Pydantic V2
  • Loading branch information
Ali-Toosi authored Sep 26, 2024
1 parent 3f85bae commit 93997c7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions chalice_spec/chalice.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
from pydantic import BaseModel


class EmptyModel(BaseModel):
pass


def default_docs_for_methods(
methods: List[str], content_types: Optional[List[str]] = None
):
Expand All @@ -22,11 +26,11 @@ def default_docs_for_methods(
**{
method: Operation(
content_types=content_types,
response=BaseModel,
response=EmptyModel,
request=(
None
if method in ["get", "delete", "head", "options"]
else BaseModel
else EmptyModel
),
)
for method in methods
Expand Down

0 comments on commit 93997c7

Please sign in to comment.