Skip to content

Commit cae9e48

Browse files
Merge pull request #182 from mishaschwartz/unrestrict-media-types
Remove restriction on valid media types for links
2 parents 68d20aa + 5b56754 commit cae9e48

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

22
## Unreleased
33

4+
- Remove restriction on valid media types for links.
5+
46
## 3.3.1 (2025-06-01)
57

68
- Add back `SearchDatetime` in `stac_pydantic.api.search` to avoid breaking change

stac_pydantic/links.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from enum import auto
2-
from typing import Iterator, List, Optional
2+
from typing import Iterator, List, Optional, Union
33
from urllib.parse import urljoin
44

55
from pydantic import ConfigDict, Field, RootModel
@@ -15,7 +15,7 @@ class Link(StacBaseModel):
1515

1616
href: str = Field(..., alias="href", min_length=1)
1717
rel: str = Field(..., alias="rel", min_length=1)
18-
type: Optional[MimeTypes] = None
18+
type: Optional[Union[MimeTypes, str]] = None
1919
title: Optional[str] = None
2020

2121
# Label extension

tests/api/test_links.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,8 @@ def test_resolve_pagination_link():
8080
for link in links.link_iterator():
8181
if isinstance(link, PaginationLink):
8282
assert link.href == "http://base_url.com/next/page"
83+
84+
85+
def test_link_types():
86+
for type_ in (MimeTypes.xml, "some random string", None):
87+
Link(href="/hello/world", type=type_, rel="test")

0 commit comments

Comments
 (0)