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 8629e94
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 188 deletions.
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
}
}
}
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
93 changes: 42 additions & 51 deletions item-spec/json-schema/item.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,6 @@
}
],
"definitions": {
"common_metadata": {
"allOf": [
{
"$ref": "basics.json"
},
{
"$ref": "datetime.json"
},
{
"$ref": "instrument.json"
},
{
"$ref": "licensing.json"
},
{
"$ref": "provider.json"
}
]
},
"core": {
"allOf": [
{
Expand Down Expand Up @@ -112,20 +93,15 @@
"minLength": 1
},
"links": {
"title": "Item links",
"description": "Links to item relations",
"type": "array",
"items": {
"$ref": "#/definitions/link"
}
"$ref": "#/definitions/links"
},
"assets": {
"$ref": "#/definitions/assets"
},
"properties": {
"allOf": [
{
"$ref": "#/definitions/common_metadata"
"$ref": "common.json"
},
{
"anyOf": [
Expand Down Expand Up @@ -192,33 +168,48 @@
}
]
},
"links": {
"title": "Item links",
"description": "Links to item relations",
"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"
"allOf": [
{
"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"
}
}
},
"title": {
"title": "Link title",
"type": "string"
{
"$ref": "common.json"
}
}
]
},
"assets": {
"title": "Asset links",
Expand Down Expand Up @@ -264,7 +255,7 @@
}
},
{
"$ref": "#/definitions/common_metadata"
"$ref": "common.json"
}
]
}
Expand Down

0 comments on commit 8629e94

Please sign in to comment.