-
Notifications
You must be signed in to change notification settings - Fork 47
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
Link "type" field required for all link relations, clarify media types in examples #368
Link "type" field required for all link relations, clarify media types in examples #368
Conversation
Should we also required media types in assets? I mean basically they are also just links and I don't see a good reason why links should have them but assets not. |
I agree, but that has to be an upstream change in stac-spec, since we don't re-define Asset in stac-api-spec. I think we should also make |
Requiring link media types is also an upstream change: radiantearth/stac-spec#1202 I don't really see a difference between assets and links, in both case we would require more than what we require in stac-spec. Having second thoughts right now... While I'm generally +1 to require type because it just helps clients a lot, it could become an issue that if you "harvest" static STAC catalogs into an API and they don't have media types, you can't simply make them available in the API anymore if the type field is required. So maybe we shouldn't enforce this in RC phase without a bit more consultation of implementers? |
I randonly stumbled across another use-case where the type is not clear and as such having it required may lead to some confusion: https://github.com/stac-extensions/web-map-links In the web-map-links extension we use templates URIs to a service. It doesn't really have a unique media type... like what's the media type of a WMTS URL? XML? PNG? JPEG? ... |
There are several different cases:
I'd also say that maybe the url template itself shouldn't be a Link, but rather the Link should be to a description of the tile service with the template defined. This is what EOD does: There is a link with a valid URL: {
"href": "https://eod-catalog-svc-prod.astraea.earth/collections/sentinel2_l2a/items/S2A_OPER_MSI_L2A_TL_EPAE_20190527T094026_A020508_T46VCQ_N02.12/maplayer?format=zxy",
"rel": "maplayer-zxy",
"title": "TMS Map Layer without Ratio",
"type": "application/json"
}, And then that link returns a body with the template for the TMS layer: {
"bounds": [
89.03962362089236,
62.0909077211768,
91.27017682914958,
63.11825012810462
],
"links": [],
"maxZoom": 16,
"minZoom": 8,
"tmsFlag": false,
"tmsLayer": "[https://ifw0t8uxa4.execute-api.eu-central-1.amazonaws.com/prod/sentinel2_l2a/tiles/{z}/{x}/{y}.png?item_id=S2A_OPER_MSI_L2A_TL_EPAE_20190527T094026_A020508_T46VCQ_N02.12&assets=B04_10m,B03_10m,B02_10m&nodata=0&color_formula=Gamma+RGB+3.5+Saturation+1.7+Sigmoidal+RGB+15+0.35](https://ifw0t8uxa4.execute-api.eu-central-1.amazonaws.com/prod/sentinel2_l2a/tiles/%7Bz%7D/%7Bx%7D/%7By%7D.png?item_id=S2A_OPER_MSI_L2A_TL_EPAE_20190527T094026_A020508_T46VCQ_N02.12&assets=B04_10m,B03_10m,B02_10m&nodata=0&color_formula=Gamma+RGB+3.5+Saturation+1.7+Sigmoidal+RGB+15+0.35)"
} I can't remember if that body is a standardized format or not, but I think it is. |
The OGC API – Tiles spec is an example where a link with a templated URL is required (for Tileset Conformance). As @philvarner points out, these still include the relevant |
I don't think it would preclude the use of a |
Yeah, I'm following @philvarner's suggestion now. I use templated URIs as href, but set the media type to the expected output file format. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. There's quite a few formatting changes in here - might be nice to just do all the relevant formatting changes (remove trailing spaces, additional spacing) in one PR that's just those. And also could be good to have formatting in CI, update it all, and then enforce it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we drifted a bit away with my questions regarding the web-map-links / templated URIs etc, I think it's still worth discussing the type requirement for links and assets in a STAC call or so. It feels weird to require them in links but not in assets although it feels they are much more valuable for assets. Not directly requesting a change here, but more a discussion :-) If this can't wait for the next STAC community meeting, also happy to bring it up in the PSC.
I created #387 to track the discussion. In this case, requiring the Link type aligns us with OAFeat, so I feel we should merge this PR to do that. I'm in favor of also requiring it for Asset, but that's a separate decision. |
removed restriction that 'type' is required
Updated text to reflect discussion at 2023-Feb-13 STAC meetup. |
@m-mohr please re-review. |
Hmm, this is a bit different to what I tried to express yesterday, but maybe that's not even possible. Let me try to explain it again: Assuming I'm implementing STAC API - Features, there are a couple of conformance classes involved, which includes
I wasn't aware yesterday that OAF seems to be required for the STAC conformance class, which makes this a bit akward. Possible solutions would be to not require OAF or to use the proposal from this PR. I think I'd prefer the former, but I'm not sure what others think. I prefer this because it leaves the option to omit the type in the use case described yesterday: ingest non-typed links from a static catalog. @gadomski As you were also involved yesterday, what did you understood? Do you have a preference? |
Agreed ... I was under the mistaken impression that an API with How hard-and-fast is the I am 👍🏽 to providing |
Yeah, I think my take would be to not require OAFeat for STAC API Features? We can recommend it with the note that this would include other requirements such as a "type" for links. On the other hand, STAC API - Features would be relatively loosely defined because we inherit many other requirements that we don't explicitly describe. Hmmm... |
I've always read this such that If we decide to break compatibility, I think we'll need to more fully define STAC API - Features, as we can't defer any absent or imprecisely defined behavior to the OAFeat spec. I'm strongly in favor of keeping our dependence on OAFeat. |
ogcapi-features/README.md
Outdated
While the STAC definition does not require the existence of the `type` field in | ||
all Link objects, this is required by OAFeat and is thereby required by the | ||
*STAC API - Features* conformance class. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the STAC definition does not require the existence of the `type` field in | |
all Link objects, this is required by OAFeat and is thereby required by the | |
*STAC API - Features* conformance class. | |
All Link objects SHALL have a `type` field, as this is required by OAFeat and is thereby required by the | |
*STAC API - Features* conformance class. | |
If the target of a Link's `type` is unknown, `type` SHOULD be set to `application/octet-stream` or `text/plain`. |
If we're keeping the direct dependency on OGC-API - Features
(#368 (comment)), this language should be made stronger IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use must
instead of shall
, but I agree with the strenth of the wording and will make a change like that.
I've thought about this more, and my belief that STAC API - Features should extend OAFeat is stronger now. I think there are two main reasons, one conceptual and one practical: Conceptually, I think the STAC specs have always taken the approach of extending other specs when possible. The most obvious of this that Item and ItemCollection extend GeoJSON Feature and FeatureCollection. Practically, as Matthias has stated with "On the other hand, STAC API - Features would be relatively loosely defined because we inherit many other requirements that we don't explicitly describe." We could just state that any behavior not otherwise defined defers to whatever OAFeat says except in this one case, which is reasonable. I also think it's okay to define the spec tightly, but also recognize that there will be implementations that don't precisely conform to it. For example, we're not going to write pystac-client so that it crashes if any asset is ever missing a |
If we create a certain requirement in a spec, but we expect a lot of folks to not follow that requirement, is that a smell? I.e. is that an indication that our spec is mis-aligned with the real world and how people would like to use our spec? OR, is this the sort of thing were we expect lots of non-compliance early, but anticipate a slow glide towards compliance as the main implementations pick up this new piece of the spec? Mostly a curiosity question -- I'm new to this spec work, so I don't have great instincts about how horses lead carts, etc. |
I think the difference is that implementations would be accidentally doing it wrong, rather than intentionally doing it differently. I think this is just one of many things that people do wrong, of the hundreds of things they have to do to conform to STAC and STAC API specs. |
One more bit of evidence that the intention was for STAC API - Feature to extend OAFeat -- the conformance class is named |
I updated the language so that all conformance classes require Link Ready for re-review. |
Please re-review @m-mohr @matthewhanson @cholmes |
Co-authored-by: Tim Schaub <tschaub@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I won't have time to look at it in March, sorry. Hope this removes/resets my "block" from the requested changes?!
Did we came to a conclustion regarding a type requirement in assets? If we can require it in links, we can likely also require it there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you added a media type to some example assets as well -- do we want to include any text around the type
field in assets? Or is that a separate / non issue?
the specs that are referenced say that it's not required, so those are just examples of best practice. I want to avoid adding more text. |
Related Issue(s):
Proposed Changes:
type
field to conform with OAFeat for STAC API - Features endpoints (but not Item Search)PR Checklist:
stac-spec
directory (these are included as a subtree and should be updated directly in radiantearth/stac-spec)