Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve JSON Schema, e.g. fixes #9 #12

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 53 additions & 22 deletions json-schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,30 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://stac-extensions.github.io/sentinel-2/v1.0.0/schema.json",
"title": "Sentinel-2 Extension",
"description": "Sentinel-2 Extension to STAC Items.",
"allOf": [
"description": "STAC Sentinel-2 Extension for STAC Items and STAC Collection Summaries.",
"type": "object",
"required": ["stac_extensions"],
"properties": {
"stac_extensions": {
"type": "array",
"contains": {
"const": "https://stac-extensions.github.io/sentinel-2/v1.0.0/schema.json"
}
}
},
"oneOf": [
{
"$comment": "This is the schema for STAC Items.",
"type": "object",
"required": [
"type",
"properties"
],
"required": ["type", "properties"],
"properties": {
"type": {
"const": "Feature"
},
"properties": {
"allOf": [
{
"required": []
"$ref": "#/definitions/require_any"
},
{
"$ref": "#/definitions/fields"
Expand All @@ -27,23 +35,46 @@
}
},
{
"$ref": "#/definitions/stac_extensions"
}
],
"definitions": {
"stac_extensions": {
"$comment": "This is the schema for STAC Collections, or more specifically only Collection Summaries in this case. By default, only checks the existence of the properties, but not the schema of the summaries.",
"type": "object",
"required": [
"stac_extensions"
],
"required": ["type", "summaries"],
"properties": {
"stac_extensions": {
"type": "array",
"contains": {
"const": "https://stac-extensions.github.io/sentinel-2/v1.0.0/schema.json"
}
"type": {
"const": "Collection"
},
"summaries": {
"$ref": "#/definitions/require_any"
}
}
}
],
"definitions": {
"require_any": {
"$comment": "Please list all fields here so that we can force the existence of one of them in other parts of the schemas.",
"anyOf": [
{ "required": ["s2:tile_id"] },
{ "required": ["s2:datatake_id"] },
{ "required": ["s2:product_uri"] },
{ "required": ["s2:datastrip_id"] },
{ "required": ["s2:product_type"] },
{ "required": ["s2:datatake_type"] },
{ "required": ["s2:generation_time"] },
{ "required": ["s2:processing_baseline"] },
{ "required": ["s2:water_percentage"] },
{ "required": ["s2:snow_ice_percentage"] },
{ "required": ["s2:vegetation_percentage"] },
{ "required": ["s2:thin_cirrus_percentage"] },
{ "required": ["s2:cloud_shadow_percentage"] },
{ "required": ["s2:nodata_pixel_percentage"] },
{ "required": ["s2:unclassified_percentage"] },
{ "required": ["s2:dark_features_percentage"] },
{ "required": ["s2:not_vegetated_percentage"] },
{ "required": ["s2:degraded_msi_data_percentage"] },
{ "required": ["s2:high_proba_clouds_percentage"] },
{ "required": ["s2:medium_proba_clouds_percentage"] },
{ "required": ["s2:saturated_defective_pixel_percentage"] },
{ "required": ["s2:reflectance_conversion_factor"] }
]
},
"fields": {
"type": "object",
Expand Down Expand Up @@ -104,7 +135,7 @@
"title": "Mean Solar Azimuth",
"type": "number",
"minimum": 0,
"maximum": 180,
"maximum": 180,
"deprecated": true
},
"s2:snow_ice_percentage": {
Expand Down Expand Up @@ -198,4 +229,4 @@
"additionalProperties": false
}
}
}
}
Loading