-
Couldn't load subscription status.
- Fork 30
Remove restriction on valid media types for links #182
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |
| from stac_pydantic.api import ItemCollection | ||
| from stac_pydantic.api.links import Link, Links, PaginationLink, Relations, SearchLink | ||
| from stac_pydantic.api.version import STAC_API_VERSION | ||
| from stac_pydantic.links import MimeTypes | ||
| from stac_pydantic.shared import MimeTypes | ||
| from stac_pydantic.version import STAC_VERSION | ||
|
|
||
| from ..conftest import request | ||
|
|
@@ -80,3 +80,8 @@ def test_resolve_pagination_link(): | |
| for link in links.link_iterator(): | ||
| if isinstance(link, PaginationLink): | ||
| assert link.href == "http://base_url.com/next/page" | ||
|
|
||
|
|
||
| def test_link_types(): | ||
| for type_ in (MimeTypes.xml, "some random string", None): | ||
| Link(href="/hello/world", type=type_, rel="test") | ||
|
Comment on lines
+86
to
+87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this test is inappropriate, or at least should not "encourage" it with explicitly validating erroneous values. Ideally, Media-type should at least validate that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I don't think there's anything technically "erroneous" about I'd be ok w/ warning if the media type doesn't fit some sort of expectation (either in our list, or that regex, or whatever), but I think an error is too strong. W.r.t. the href, there's a lot of "absolute file system" hrefs in the wild, so I'm ok with including it here. If we wanted to be "correct" we could update it to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe? I guess I'm just curious what we're trying to gain by validating others' media types. I generally favor "permissive reads, strict writes" for STAC tooling For this library, I think that means warning on "surprising" (not erroring) media types and providing string constants for "correct" ones (which we do). Regarding the split question, I've seen a lot of libraries do direct string matching (not splitting) , which means subtypes or profiles (like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm fine if that's the decision. My understanding was that it was the opposite with strict validation given that the (too)specific set of |
||
Uh oh!
There was an error while loading. Please reload this page.