Skip to content

Commit

Permalink
Publish JSON Schemas [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
STAC CI committed Aug 5, 2024
1 parent eaa20bd commit 6bd63c2
Show file tree
Hide file tree
Showing 4 changed files with 192 additions and 30 deletions.
24 changes: 24 additions & 0 deletions dev/item-spec/json-schema/bands.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/bands.json",
"title": "Bands Field",
"type": "object",
"properties": {
"bands": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
},
"allOf": [
{
"$ref": "common.json"
}
]
}
}
}
}
6 changes: 6 additions & 0 deletions dev/item-spec/json-schema/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@
{
"$ref": "basics.json"
},
{
"$ref": "bands.json"
},
{
"$ref": "datetime.json"
},
{
"$ref": "data-values.json"
},
{
"$ref": "instrument.json"
},
Expand Down
84 changes: 84 additions & 0 deletions dev/item-spec/json-schema/data-values.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schemas.stacspec.org/v1.0.0/item-spec/json-schema/data-values.json#",
"title": "Fields related to data values",
"type": "object",
"properties": {
"data_type": {
"title": "Data type of the values",
"type": "string",
"enum": [
"int8",
"int16",
"int32",
"int64",
"uint8",
"uint16",
"uint32",
"uint64",
"float16",
"float32",
"float64",
"cint16",
"cint32",
"cfloat32",
"cfloat64",
"other"
]
},
"nodata": {
"title": "No data value",
"oneOf": [
{
"type": "number"
},
{
"type": "string",
"enum": [
"nan",
"inf",
"-inf"
]
}
]
},
"statistics": {
"title": "Statistics",
"type": "object",
"minProperties": 1,
"properties": {
"minimum": {
"title": "Minimum value of all the data values",
"type": "number"
},
"maximum": {
"title": "Maximum value of all the data values",
"type": "number"
},
"mean": {
"title": "Mean value of all the data values",
"type": "number"
},
"stddev": {
"title": "Standard deviation value of all the data values",
"type": "number"
},
"count": {
"title": "Total number of all data values",
"type": "integer",
"minimum": 0
},
"valid_percent": {
"title": "Percentage of valid (not nodata) values",
"type": "number",
"minimum": 0,
"maximum": 100
}
}
},
"unit": {
"title": "Unit denomination of the data value",
"type": "string"
}
}
}
108 changes: 78 additions & 30 deletions dev/item-spec/json-schema/item.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,42 +129,90 @@
]
}
},
"if": {
"properties": {
"links": {
"contains": {
"required": [
"rel"
],
"properties": {
"rel": {
"const": "collection"
"$comment": "Rules enforcement for STAC Item",
"allOf": [
{
"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": {}
}
}
}
}
},
"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": {}
},
{
"$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": {
"required": [
"assets"
],
"properties": {
"assets": {
"type": "object",
"additionalProperties": {
"properties": {
"bands": false
}
}
}
}
},
"then": {
"properties": {
"properties": {
"anyOf": [
{
"$ref": "bands.json"
},
{
"properties": {
"bands": false
}
}
]
}
}
},
"else": {
"properties": {
"properties": {
"properties": {
"bands": false
}
}
}
}
}
}
]
}
]
},
Expand Down

0 comments on commit 6bd63c2

Please sign in to comment.