Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround for #150 FastAPI shows no attributes for models. #153

Merged
merged 6 commits into from
Jan 16, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion geojson_pydantic/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ def validate_bbox(cls, bbox: Optional[BBox]) -> Optional[BBox]:

return bbox

# This return is untyped due to a workaround until this issue is resolved:
# https://github.com/tiangolo/fastapi/discussions/10661
@model_serializer(when_used="always", mode="wrap")
def clean_model(self, serializer: Any, info: SerializationInfo) -> Dict[str, Any]:
def clean_model(self, serializer: Any, info: SerializationInfo): # type: ignore [no-untyped-def]
"""Custom Model serializer to match the GeoJSON specification.

Used to remove fields which are optional but cannot be null values.
Expand Down
Loading