Skip to content

Commit

Permalink
Merge pull request #1307 from radiantearth/editorial
Browse files Browse the repository at this point in the history
Fix item_asset and bands schema, fix typos
  • Loading branch information
m-mohr authored Aug 8, 2024
2 parents ceff596 + 6ce2722 commit 2e6947d
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 68 deletions.
4 changes: 2 additions & 2 deletions best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,9 @@ As such you can deduplicate those properties and list them in the asset directly

It should be relatively simple to migrate from STAC 1.0 (i.e. `eo:bands` and/or `raster:bands`) to the new `bands` array.

Usually, you can simply merge the each object on a by-index basis.
Usually, you can simply merge each object on a by-index basis.
Nevertheless, you should consider deduplicating properties with the same values across all bands to the Asset.
For some fields you need to add the extension prefix of the `eo` or `raster` extension to the property name.
For some fields, you need to add the extension prefix of the `eo` or `raster` extension to the property name.

STAC 1.0 example:

Expand Down
62 changes: 32 additions & 30 deletions collection-spec/json-schema/collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,40 +132,42 @@
"$ref": "../../item-spec/json-schema/item.json#/definitions/assets"
},
"item_assets": {
"allOf": [
{
"type": "object",
"minProperties": 2,
"properties": {
"href": {
"title": "Disallow href",
"not": {}
},
"title": {
"title": "Asset title",
"type": "string"
},
"description": {
"title": "Asset description",
"type": "string"
},
"type": {
"title": "Asset type",
"type": "string"
},
"roles": {
"title": "Asset roles",
"type": "array",
"items": {
"additionalProperties": {
"allOf": [
{
"type": "object",
"minProperties": 2,
"properties": {
"href": {
"title": "Disallow href",
"not": {}
},
"title": {
"title": "Asset title",
"type": "string"
},
"description": {
"title": "Asset description",
"type": "string"
},
"type": {
"title": "Asset type",
"type": "string"
},
"roles": {
"title": "Asset roles",
"type": "array",
"items": {
"type": "string"
}
}
}
},
{
"$ref": "../../item-spec/json-schema/common.json"
}
},
{
"$ref": "../../item-spec/json-schema/common.json"
}
]
]
}
},
"links": {
"$ref": "../../item-spec/json-schema/item.json#/definitions/links"
Expand Down
4 changes: 2 additions & 2 deletions commons/common-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,10 @@ Please refer to the [Bands best practices](../best-practices.md#bands) for more
> \[!NOTE]
> This property is the successor of the `eo:bands` and `raster:bands` fields, which has been present in previous versions of these extensions.
> The behavior is very similar and they can be migrated easily.
> Usually, you can simply merge the each object on a by-index basis.
> Usually, you can simply merge each object on a by-index basis.
> Nevertheless, you should consider deduplicating properties with the same values across all bands to the asset level
> (see the [best practices](../best-practices.md#multiple-bands)).
> For some fields you need to add the extension prefix of the `eo` or `raster` extension to the property name though.
> For some fields, you need to add the extension prefix of the `eo` or `raster` extension to the property name though.
> See the [Band migration best practice](../best-practices.md#band-migration) for details.
### Band Object
Expand Down
42 changes: 21 additions & 21 deletions item-spec/json-schema/bands.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schemas.stacspec.org/v1.1.0-beta.1/item-spec/json-schema/bands.json",
"title": "Bands Field",
"type": "object",
"properties": {
"bands": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
},
"allOf": [
{
"$ref": "common.json"
}
]
}
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schemas.stacspec.org/v1.1.0-beta.1/item-spec/json-schema/bands.json",
"title": "Bands Field",
"type": "object",
"properties": {
"bands": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
},
"allOf": [
{
"$ref": "common.json"
}
]
}
}
}
}
}
20 changes: 7 additions & 13 deletions item-spec/json-schema/item.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
{
"$comment": "The if-then-else below checks whether the bands field is given in assets or not. If not, allows bands in properties (then), otherwise, disallows bands in properties (else).",
"if": {
"$comment": "If there is no asset with bands...",
"required": [
"assets"
],
Expand All @@ -187,27 +188,20 @@
}
},
"then": {
"$comment": "... then bands are not allowed in properties...",
"properties": {
"properties": {
"anyOf": [
{
"$ref": "bands.json"
},
{
"properties": {
"bands": false
}
}
]
"properties": {
"bands": false
}
}
}
},
"else": {
"$comment": "... otherwise bands are allowed in properties.",
"properties": {
"properties": {
"properties": {
"bands": false
}
"$ref": "bands.json"
}
}
}
Expand Down

0 comments on commit 2e6947d

Please sign in to comment.