@@ -67,7 +67,7 @@ class Link(PathLike):
67
67
"""The relation of the link (e.g. 'child', 'item'). Registered rel Types are
68
68
preferred. See :class:`~pystac.RelType` for common media types."""
69
69
70
- media_type : Optional [str ]
70
+ media_type : Optional [Union [ str , pystac . MediaType ] ]
71
71
"""Optional description of the media type. Registered Media Types are preferred.
72
72
See :class:`~pystac.MediaType` for common media types."""
73
73
@@ -88,7 +88,7 @@ def __init__(
88
88
self ,
89
89
rel : Union [str , pystac .RelType ],
90
90
target : Union [str , STACObject ],
91
- media_type : Optional [str ] = None ,
91
+ media_type : Optional [Union [ str , pystac . MediaType ] ] = None ,
92
92
title : Optional [str ] = None ,
93
93
extra_fields : Optional [Dict [str , Any ]] = None ,
94
94
) -> None :
@@ -372,12 +372,12 @@ def to_dict(self, transform_href: bool = True) -> Dict[str, Any]:
372
372
"""
373
373
374
374
d : Dict [str , Any ] = {
375
- "rel" : self .rel ,
375
+ "rel" : str ( self .rel ) ,
376
376
"href" : self .get_href (transform_href = transform_href ),
377
377
}
378
378
379
379
if self .media_type is not None :
380
- d ["type" ] = self .media_type
380
+ d ["type" ] = str ( self .media_type )
381
381
382
382
if self .title is not None :
383
383
d ["title" ] = self .title
0 commit comments