diff --git a/stac_model/base.py b/stac_model/base.py index ebbedb0..ec82721 100644 --- a/stac_model/base.py +++ b/stac_model/base.py @@ -17,7 +17,7 @@ class MLMBaseModel(BaseModel): """ Allows wrapping any field with an annotation to drop it entirely if unset. - ``` + ```python field: Annotated[Optional[], OmitIfNone] = None # or field: Annotated[, OmitIfNone] = None @@ -26,6 +26,8 @@ class MLMBaseModel(BaseModel): ``` It is important to use `MLMBaseModel`, otherwise the serializer will not be called and applied. + + Reference: https://github.com/pydantic/pydantic/discussions/5461#discussioncomment-7503283 """ @model_serializer def model_serialize(self):