Skip to content
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

Relative vs absolute link edits #953

Merged
merged 7 commits into from
Feb 4, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

- Clarified the role of geometries on items in the label extension
- Data Cube Extension: Units for STAC dimensions in should now be compliant to UDUNITS-2 units (singular) whenever available.
- URIs (usually found int properties like `href`, `url`) are now validated using the `iri-reference` format in JSON Schema (allows international characters in URIs)
- Relaxed the regular expression for DOIs in the scientific extension ([#910](https://github.com/radiantearth/stac-spec/issues/910))

### Removed
Expand Down
6 changes: 3 additions & 3 deletions best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,10 @@ STAC version. Otherwise some behaviour of functionality may be unpredictable (e.

## Use of links

The main catalog specification allows both relative and absolute links, and says that `self` links are not required, but are
The STAC specifications allow both relative and absolute links, and says that `self` links are not required, but are
strongly recommended. This is what the spec must say to enable the various use cases, but there is more subtlety for when it
is essential to use different link types. The best practice is to use one of the below
catalog types, applying the link recommendations consistently, instead of just haphazardly applying anything the spec allows.
is essential to use different link types. The best practice is to use one of the below catalog types, applying the link
recommendations consistently, instead of just haphazardly applying relative links in some places and absolute ones in other places.

### Self-contained Catalogs

Expand Down
5 changes: 2 additions & 3 deletions catalog-spec/catalog-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ with links.

A more complete list of possible 'rel' types can be seen at the [IANA page of Link Relation Types](https://www.iana.org/assignments/link-relations/link-relations.xhtml).

Please see the chapter 'relative vs absolute links' in the [Item spec](../item-spec/item-spec.md#relative-vs-absolute-links)
for a discussion on that topic, as well as the [use of links](../best-practices.md#use-of-links) section of the
catalog best practices document.
For a full discussion of the situations where relative and absolute links are recommended see the
['Use of links'](../best-practices.md#use-of-links) section of the STAC best practices.

#### Relation types

Expand Down
5 changes: 3 additions & 2 deletions catalog-spec/json-schema/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
{
"title": "Reference to a JSON Schema",
"type": "string",
"format": "uri"
"format": "iri"
},
{
"title": "Reference to a core extension",
Expand Down Expand Up @@ -72,7 +72,8 @@
"properties": {
"href": {
"title": "Link reference",
"type": "string"
"type": "string",
"format": "iri-reference"
},
"rel": {
"title": "Link relation type",
Expand Down
5 changes: 4 additions & 1 deletion collection-spec/collection-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ This object describes a relationship with another entity. Data providers are adv
| type | string | [Media type](../item-spec/item-spec.md#media-types) of the referenced entity. |
| title | string | A human readable title to be used in rendered displays of the link. |

Please see the chapter 'relative vs absolute links' in the [Item spec](../item-spec/item-spec.md#relative-vs-absolute-links) for a discussion on that topic.
A more complete list of possible 'rel' types can be seen at the [IANA page of Link Relation Types](https://www.iana.org/assignments/link-relations/link-relations.xhtml).

For a full discussion of the situations where relative and absolute links are recommended see the
['Use of links'](../best-practices.md#use-of-links) section of the STAC best practices.

#### Relation types

Expand Down
4 changes: 2 additions & 2 deletions collection-spec/json-schema/collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
{
"title": "Reference to a JSON Schema",
"type": "string",
"format": "uri"
"format": "iri"
},
{
"title": "Reference to a core extension",
Expand Down Expand Up @@ -83,7 +83,7 @@
"url": {
"title": "Organization homepage",
"type": "string",
"format": "url"
"format": "iri"
}
}
}
Expand Down
9 changes: 2 additions & 7 deletions item-spec/item-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,8 @@ It is allowed to add additional fields such as a `title` and `type`.
| type | string | [Media type](#media-types) of the referenced entity. |
| title | string | A human readable title to be used in rendered displays of the link. |

#### Relative vs Absolute links

Currently, the JSON schema for links does not require them to be formatted as URIs, to allow
implementors to provide relative links. In general, Catalog APIs should aim to provide absolute links
whenever possible. Static Catalogs are potentially more portable if they incorporate only
relative links, so that every link doesn't need to be rewritten when the data is copied. Additional
recommendations for particular `rel` types are given in the `rel` type description.
For a full discussion of the situations where relative and absolute links are recommended see the
['Use of links'](../best-practices.md#use-of-links) section of the STAC best practices.

#### Relation types

Expand Down
8 changes: 5 additions & 3 deletions item-spec/json-schema/item.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
{
"title": "Reference to a JSON Schema",
"type": "string",
"format": "uri"
"format": "iri"
},
{
"title": "Reference to a core extension",
Expand Down Expand Up @@ -150,7 +150,8 @@
"properties": {
"href": {
"title": "Link reference",
"type": "string"
"type": "string",
"format": "iri-reference"
},
"rel": {
"title": "Link relation type",
Expand Down Expand Up @@ -188,7 +189,8 @@
"properties": {
"href": {
"title": "Asset reference",
"type": "string"
"type": "string",
"format": "iri-reference"
},
"title": {
"title": "Asset title",
Expand Down
2 changes: 1 addition & 1 deletion item-spec/json-schema/provider.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"url": {
"title": "Organization homepage",
"type": "string",
"format": "url"
"format": "iri"
}
}
}
Expand Down