From 90f8d37ba6b065240061c8da33cecfffe89b67f0 Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Thu, 15 Apr 2021 14:37:12 +0200 Subject: [PATCH 1/3] Update STAC Node Validator and fix examples --- examples/extensions-collection/proj-example/proj-example.json | 1 - package.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/extensions-collection/proj-example/proj-example.json b/examples/extensions-collection/proj-example/proj-example.json index 91fa8130..e8e0d89f 100644 --- a/examples/extensions-collection/proj-example/proj-example.json +++ b/examples/extensions-collection/proj-example/proj-example.json @@ -242,7 +242,6 @@ "eo:bands": [ { "name": "B8", - "common_name": "panchromatic", "center_wavelength": 0.59, "full_width_half_max": 0.18 } diff --git a/package.json b/package.json index 3fb2aeee..a787cad3 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,6 @@ "remark-preset-lint-markdown-style-guide": "^3.0.0", "remark-preset-lint-recommended": "^4.0.0", "remark-validate-links": "^10.0.0", - "stac-node-validator": "^0.4.6" + "stac-node-validator": "^1.0.1" } } From 6c8df30064e2552b0070404effca6e9acbc836cb Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Thu, 15 Apr 2021 16:07:22 +0200 Subject: [PATCH 2/3] Item: Validate that collection property is set if link with collection rel type is available #1088 --- .../proj-example/proj-example.json | 5 +++ item-spec/item-spec.md | 2 +- item-spec/json-schema/item.json | 42 ++++++++++++++++--- 3 files changed, 42 insertions(+), 7 deletions(-) diff --git a/examples/extensions-collection/proj-example/proj-example.json b/examples/extensions-collection/proj-example/proj-example.json index e8e0d89f..71d3b2d3 100644 --- a/examples/extensions-collection/proj-example/proj-example.json +++ b/examples/extensions-collection/proj-example/proj-example.json @@ -219,6 +219,11 @@ "rel": "parent", "href": "../collection.json", "type": "application/json" + }, + { + "rel": "collection", + "href": "../collection.json", + "type": "application/json" } ], "assets": { diff --git a/item-spec/item-spec.md b/item-spec/item-spec.md index 84209294..e36b3551 100644 --- a/item-spec/item-spec.md +++ b/item-spec/item-spec.md @@ -63,7 +63,7 @@ inherited from GeoJSON. | properties | [Properties Object](#properties-object) | **REQUIRED.** A dictionary of additional metadata for the Item. | | links | \[[Link Object](#link-object)] | **REQUIRED.** List of link objects to resources and related URLs. A link with the `rel` set to `self` is strongly recommended. | | assets | Map | **REQUIRED.** Dictionary of asset objects that can be downloaded, each with a unique key. | -| collection | string | The `id` of the STAC Collection this Item references to (see [`collection` relation type](#relation-types)). This field is *required* if such a relation type is present. This field provides an easy way for a user to search for any Items that belong in a specified Collection. Must be a non-empty string. | +| collection | string | The `id` of the STAC Collection this Item references to (see [`collection` relation type](#relation-types)). This field is *required* if such a relation type is present and is *not allowed* otherwise. This field provides an easy way for a user to search for any Items that belong in a specified Collection. Must be a non-empty string. | ### Additional Field Information diff --git a/item-spec/json-schema/item.json b/item-spec/json-schema/item.json index 34d351f3..e228e2d2 100644 --- a/item-spec/json-schema/item.json +++ b/item-spec/json-schema/item.json @@ -159,12 +159,42 @@ ] } ] - }, - "collection": { - "title": "Collection ID", - "description": "The ID of the STAC Collection this Item references to.", - "type": "string", - "minLength": 1 + } + }, + "if": { + "properties": { + "links": { + "contains": { + "required": [ + "rel" + ], + "properties": { + "rel": { + "const": "collection" + } + } + } + } + } + }, + "then": { + "required": [ + "collection" + ], + "properties": { + "collection": { + "title": "Collection ID", + "description": "The ID of the STAC Collection this Item references to.", + "type": "string", + "minLength": 1 + } + } + }, + "else": { + "properties": { + "collection": { + "not": {} + } } } } From 93765a55968d66b3efbf5f9bc8594623132cd07b Mon Sep 17 00:00:00 2001 From: Chris Holmes Date: Thu, 15 Apr 2021 08:15:50 -0700 Subject: [PATCH 3/3] Made requirement for collection fields / rels clearer --- item-spec/item-spec.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/item-spec/item-spec.md b/item-spec/item-spec.md index e36b3551..6349b015 100644 --- a/item-spec/item-spec.md +++ b/item-spec/item-spec.md @@ -183,7 +183,7 @@ This happens where there is not a clear official option, or where STAC uses an o | self | STRONGLY RECOMMENDED. *Absolute* URL to the Item if it is available at a public URL. This is particularly useful when in a download package that includes metadata, so that the downstream user can know where the data has come from. | | root | URL to the root STAC Catalog or Collection. | | parent | URL to the parent STAC Catalog or Collection. | -| collection | STRONGLY RECOMMENDED. URL to a Collection. *Absolute* URLs should be used whenever possible. The referenced Collection is STRONGLY RECOMMENDED to implement the same STAC version as the Item. | +| collection | STRONGLY RECOMMENDED. URL to a Collection. *Absolute* URLs should be used whenever possible. The referenced Collection is STRONGLY RECOMMENDED to implement the same STAC version as the Item. A link with this `rel` type is *required* if the `collection` field in properties is present. | | derived_from | URL to a STAC Item that was used as input data in the creation of this Item. | A more complete list of potential `rel` types and their meaning in STAC can be found in the [Using Relation