@@ -67,7 +67,7 @@ class Link(PathLike):
6767 """The relation of the link (e.g. 'child', 'item'). Registered rel Types are
6868 preferred. See :class:`~pystac.RelType` for common media types."""
6969
70- media_type : Optional [str ]
70+ media_type : Optional [Union [ str , pystac . MediaType ] ]
7171 """Optional description of the media type. Registered Media Types are preferred.
7272 See :class:`~pystac.MediaType` for common media types."""
7373
@@ -88,7 +88,7 @@ def __init__(
8888 self ,
8989 rel : Union [str , pystac .RelType ],
9090 target : Union [str , STACObject ],
91- media_type : Optional [str ] = None ,
91+ media_type : Optional [Union [ str , pystac . MediaType ] ] = None ,
9292 title : Optional [str ] = None ,
9393 extra_fields : Optional [Dict [str , Any ]] = None ,
9494 ) -> None :
@@ -372,12 +372,12 @@ def to_dict(self, transform_href: bool = True) -> Dict[str, Any]:
372372 """
373373
374374 d : Dict [str , Any ] = {
375- "rel" : self .rel ,
375+ "rel" : str ( self .rel ) ,
376376 "href" : self .get_href (transform_href = transform_href ),
377377 }
378378
379379 if self .media_type is not None :
380- d ["type" ] = self .media_type
380+ d ["type" ] = str ( self .media_type )
381381
382382 if self .title is not None :
383383 d ["title" ] = self .title
0 commit comments