Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Item: Validate that collection property is set if link with collectio…
Browse files Browse the repository at this point in the history
…n rel type is available #1088
m-mohr committed Apr 15, 2021

Verified

This commit was signed with the committer’s verified signature.
lann Lann
1 parent 90f8d37 commit 6c8df30
Showing 3 changed files with 42 additions and 7 deletions.
5 changes: 5 additions & 0 deletions examples/extensions-collection/proj-example/proj-example.json
Original file line number Diff line number Diff line change
@@ -219,6 +219,11 @@
"rel": "parent",
"href": "../collection.json",
"type": "application/json"
},
{
"rel": "collection",
"href": "../collection.json",
"type": "application/json"
}
],
"assets": {
2 changes: 1 addition & 1 deletion item-spec/item-spec.md
Original file line number Diff line number Diff line change
@@ -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<string, [Asset Object](#asset-object)> | **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

42 changes: 36 additions & 6 deletions item-spec/json-schema/item.json
Original file line number Diff line number Diff line change
@@ -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": {}
}
}
}
}

0 comments on commit 6c8df30

Please sign in to comment.