Skip to content

Commit

Permalink
Re-uses and validates common metadata everywhere #1199 #1187
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Jan 5, 2023
1 parent a4d3ce4 commit 54a8cb8
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 188 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Changed

- Validate common metadata also in Catalogs, Collections and Links.
- Common metadata: If a description is given, require that it is not empty

### Removed

- "Strongly recommended" language around `self` links in the item spec. ([#1173](https://github.com/radiantearth/stac-spec/pull/1173))

### Fixed

- Several typos and minor language changes

## [v1.0.0] - 2021-05-25

### Added
Expand Down
47 changes: 5 additions & 42 deletions catalog-spec/json-schema/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
"allOf": [
{
"$ref": "#/definitions/catalog"
},
{
"$ref": "../../item-spec/json-schema/common.json#"
}
],
"definitions": {
"catalog": {
"title": "STAC Catalog",
"type": "object",
"$comment": "title and description is validated through the common metadata.",
"required": [
"stac_version",
"type",
Expand Down Expand Up @@ -44,49 +48,8 @@
"type": "string",
"minLength": 1
},
"title": {
"title": "Title",
"type": "string"
},
"description": {
"title": "Description",
"type": "string",
"minLength": 1
},
"links": {
"title": "Links",
"type": "array",
"items": {
"$ref": "#/definitions/link"
}
}
}
},
"link": {
"type": "object",
"required": [
"rel",
"href"
],
"properties": {
"href": {
"title": "Link reference",
"type": "string",
"format": "iri-reference",
"minLength": 1
},
"rel": {
"title": "Link relation type",
"type": "string",
"minLength": 1
},
"type": {
"title": "Link type",
"type": "string"
},
"title": {
"title": "Link title",
"type": "string"
"$ref": "../../item-spec/json-schema/item.json#/definitions/links"
}
}
}
Expand Down
91 changes: 6 additions & 85 deletions collection-spec/json-schema/collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
"allOf": [
{
"$ref": "#/definitions/collection"
},
{
"$ref": "../../item-spec/json-schema/common.json#"
}
],
"definitions": {
"collection": {
"title": "STAC Collection",
"description": "These are the fields specific to a STAC Collection. All other fields are inherited from STAC Catalog.",
"description": "These are the fields specific to a STAC Collection.",
"type": "object",
"$comment": "title, description, providers and license is validated through the common metadata.",
"required": [
"stac_version",
"type",
Expand Down Expand Up @@ -47,64 +51,13 @@
"type": "string",
"minLength": 1
},
"title": {
"title": "Title",
"type": "string"
},
"description": {
"title": "Description",
"type": "string",
"minLength": 1
},
"keywords": {
"title": "Keywords",
"type": "array",
"items": {
"type": "string"
}
},
"license": {
"title": "Collection License Name",
"type": "string",
"pattern": "^[\\w\\-\\.\\+]+$"
},
"providers": {
"type": "array",
"items": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"title": "Organization name",
"type": "string"
},
"description": {
"title": "Organization description",
"type": "string"
},
"roles": {
"title": "Organization roles",
"type": "array",
"items": {
"type": "string",
"enum": [
"producer",
"licensor",
"processor",
"host"
]
}
},
"url": {
"title": "Organization homepage",
"type": "string",
"format": "iri"
}
}
}
},
"extent": {
"title": "Extents",
"type": "object",
Expand Down Expand Up @@ -178,45 +131,13 @@
"$ref": "../../item-spec/json-schema/item.json#/definitions/assets"
},
"links": {
"title": "Links",
"type": "array",
"items": {
"$ref": "#/definitions/link"
}
"$ref": "../../item-spec/json-schema/item.json#/definitions/links"
},
"summaries": {
"$ref": "#/definitions/summaries"
}
}
},
"link": {
"type": "object",
"required": [
"rel",
"href"
],
"properties": {
"href": {
"title": "Link reference",
"type": "string",
"format": "iri-reference",
"minLength": 1
},
"rel": {
"title": "Link relation type",
"type": "string",
"minLength": 1
},
"type": {
"title": "Link type",
"type": "string"
},
"title": {
"title": "Link title",
"type": "string"
}
}
},
"summaries": {
"type": "object",
"additionalProperties": {
Expand Down
2 changes: 0 additions & 2 deletions item-spec/common-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ or [Collection Asset](../collection-spec/collection-spec.md#asset-object).
Various *examples* are available in the folder [`examples`](../examples/).
*JSON Schemas* can be found in the folder [`json-schema`](json-schema/).

By default, these fields are only included and validated against in the core [Item schema](json-schema/item.json).

Implementation of any of the fields is not required, unless explicitly required by a specification using the field.
For example, `datetime` is required in STAC Items.

Expand Down
11 changes: 6 additions & 5 deletions item-spec/json-schema/basics.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
"type": "object",
"properties": {
"title": {
"title": "Item Title",
"description": "A human-readable title describing the Item.",
"title": "Title",
"description": "A human-readable title describing the entity.",
"type": "string"
},
"description": {
"title": "Item Description",
"description": "Detailed multi-line description to fully explain the Item.",
"type": "string"
"title": "Description",
"description": "Detailed multi-line description to fully explain the entity.",
"type": "string",
"minLength": 1
}
}
}
24 changes: 24 additions & 0 deletions item-spec/json-schema/common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schemas.stacspec.org/v1.0.0/item-spec/json-schema/commonjson#",
"title": "STAC Common Metadata",
"type": "object",
"description": "This schema includes all common metadata fields.",
"allOf": [
{
"$ref": "basics.json"
},
{
"$ref": "datetime.json"
},
{
"$ref": "instrument.json"
},
{
"$ref": "licensing.json"
},
{
"$ref": "provider.json"
}
]
}
6 changes: 3 additions & 3 deletions item-spec/json-schema/datetime.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@
"properties": {
"datetime": {
"title": "Date and Time",
"description": "The searchable date/time of the assets, in UTC (Formatted in RFC 3339) ",
"description": "The searchable date/time of the data, in UTC (Formatted in RFC 3339) ",
"type": ["string", "null"],
"format": "date-time",
"pattern": "(\\+00:00|Z)$"
},
"start_datetime": {
"title": "Start Date and Time",
"description": "The searchable start date/time of the assets, in UTC (Formatted in RFC 3339) ",
"description": "The searchable start date/time of the data, in UTC (Formatted in RFC 3339) ",
"type": "string",
"format": "date-time",
"pattern": "(\\+00:00|Z)$"
},
"end_datetime": {
"title": "End Date and Time",
"description": "The searchable end date/time of the assets, in UTC (Formatted in RFC 3339) ",
"description": "The searchable end date/time of the data, in UTC (Formatted in RFC 3339) ",
"type": "string",
"format": "date-time",
"pattern": "(\\+00:00|Z)$"
Expand Down
Loading

0 comments on commit 54a8cb8

Please sign in to comment.