-
Notifications
You must be signed in to change notification settings - Fork 126
Let non-hierarchical links to hierachical elements be relative paths for self-contained catalogs #1169
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
Let non-hierarchical links to hierachical elements be relative paths for self-contained catalogs #1169
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1169 +/- ##
==========================================
+ Coverage 91.99% 92.00% +0.01%
==========================================
Files 51 51
Lines 6792 6808 +16
Branches 1000 1007 +7
==========================================
+ Hits 6248 6264 +16
Misses 368 368
Partials 176 176
☔ View full report in Codecov by Sentry. |
gadomski
left a comment
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.
Can you add a test case that mirrors the example in the PR description? Thanks!
1cfea0c to
2fafeaa
Compare
2fafeaa to
1cda6f0
Compare
b275f65 to
c49c9d9
Compare
c49c9d9 to
ed1f446
Compare
Related Issue(s):
Closes #1112
Description:
This is an attempt to address the unexpected and maybe undesirable behavior identified in #1112. For this, we consider the case of a catalog tree which is defined using hierarchical links. When serialized out as a self-contained catalog, using
to_dictyields relative links for all elements. Now, when we add additional links that have non-hierarchicalreltypes, but refer to entities which are in the hierarchical tree, the non-standard links are serialized with absolute hrefs.For the following tree
flowchart TD root -- child --> A root --child--> B A -. sibling .-> BWhen we serialize
A, we want to see{ "type": "Catalog", "id": "a", "stac_version": "1.0.0", "description": "a", "links": [ { "rel": "root", "href": "../catalog.json", "type": "application/json" }, { "rel": "sibling", "href": "../b/catalog.json" }, { "rel": "parent", "href": "../catalog.json", "type": "application/json" }, { "rel": "self", "href": "/opt/data/stac/a/catalog.json", "type": "application/json" } ] }because the referent of the
siblinglink has been serialized elsewhere in the catalog tree using a relative link. This is the result that is delivered by this PR. Whether this should be the default behavior is a separate concern, and we can have that discussion below.PR Checklist:
pre-commithooks pass locallyscripts/test)