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 2 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
2 changes: 1 addition & 1 deletion geojson_pydantic/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def validate_bbox(cls, bbox: Optional[BBox]) -> Optional[BBox]:
return bbox

@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) -> Any:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@markus-work what happens if we use Dict or Dict[Any, Any] instead of Any

TBH, I'm not quite sure of all the implication of this change (cc @eseglem)

I would also add a comment in the code directly about this change/issue

"""Custom Model serializer to match the GeoJSON specification.

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