Skip to content

Commit

Permalink
Final alignment of schema with template, v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Jul 26, 2021
1 parent 7530dd8 commit cf0c58f
Showing 1 changed file with 34 additions and 25 deletions.
59 changes: 34 additions & 25 deletions json-schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "Datacube Extension for STAC Items and STAC Collections.",
"oneOf": [
{
"$comment": "This is the schema for STAC Items.",
"$comment": "This is the schema for STAC Items. Remove this object if this extension only applies to Collections.",
"allOf": [
{
"$ref": "#/definitions/stac_extensions"
Expand All @@ -24,21 +24,21 @@
"properties": {
"allOf": [
{
"$ref": "#/definitions/requirements"
"$comment": "Require fields here for Item Properties.",
"required": [
"cube:dimensions"
]
},
{
"$ref": "#/definitions/fields"
}
]
},
"assets": {
"$comment": "This validates the fields in Item Assets, but does not require them.",
"type": "object",
"not": {
"additionalProperties": {
"not": {
"$ref": "#/definitions/fields"
}
}
"additionalProperties": {
"$ref": "#/definitions/fields"
}
}
}
Expand All @@ -65,18 +65,21 @@
],
"anyOf": [
{
"$comment": "This is the schema for the top-level fields in a Collection.",
"$comment": "This is the schema for the top-level fields in a Collection. Remove this if this extension does not define top-level fields for Collections.",
"allOf": [
{
"$ref": "#/definitions/requirements"
"$comment": "Require fields here for Collections (top-level).",
"required": [
"cube:dimensions"
]
},
{
"$ref": "#/definitions/fields"
}
]
},
{
"$comment": "This is the schema for the fields in Collection Assets.",
"$comment": "This validates the fields in Collection Assets, but does not require them.",
"required": [
"assets"
],
Expand All @@ -88,7 +91,7 @@
"not": {
"allOf": [
{
"$ref": "#/definitions/requirements"
"$ref": "#/definitions/require_any_field"
},
{
"$ref": "#/definitions/fields"
Expand All @@ -101,7 +104,7 @@
}
},
{
"$comment": "This is the schema for the fields in Item Asset Definitions.",
"$comment": "This is the schema for the fields in Item Asset Definitions. It doesn't require any fields.",
"required": [
"item_assets"
],
Expand All @@ -111,21 +114,28 @@
"not": {
"additionalProperties": {
"not": {
"$ref": "#/definitions/fields"
"allOf": [
{
"$ref": "#/definitions/require_any_field"
},
{
"$ref": "#/definitions/fields"
}
]
}
}
}
}
}
},
{
"$comment": "This is the schema for the fields in Summaries. by default, only checks the existance of the properties, but not the schema of the summaries.",
"$comment": "This is the schema for the fields in Summaries. By default, only checks the existance of the properties, but not the schema of the summaries.",
"required": [
"summaries"
],
"properties": {
"summaries": {
"$ref": "#/definitions/summaryRequirements"
"$ref": "#/definitions/require_any_field"
}
}
}
Expand All @@ -147,7 +157,15 @@
}
}
},
"require_any_field": {
"$comment": "Please list all fields here so that we can force the existance of one of them in other parts of the schemas.",
"anyOf": [
{"required": ["cube:dimensions"]},
{"required": ["cube:variables"]}
]
},
"fields": {
"$comment": "Add your new fields here. Don't require them here, do that above in the corresponding schema.",
"type": "object",
"properties": {
"cube:dimensions": {
Expand All @@ -162,15 +180,6 @@
},
"additionalProperties": false
},
"requirements": {
"required": ["cube:dimensions"]
},
"summaryRequirements": {
"anyOf": [
{"required": ["cube:dimensions"]},
{"required": ["cube:variables"]}
]
},
"cube:dimensions": {
"type": "object",
"additionalProperties": {
Expand Down

0 comments on commit cf0c58f

Please sign in to comment.