From 31b43f86e81d123a3161c0f4481f02d094bd2ef4 Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Mon, 8 Jul 2024 17:07:52 +0200 Subject: [PATCH] Fix JSON Schema for recent bands PR --- CHANGELOG.md | 7 ++--- json-schema/schema.json | 58 ++++++++++++++--------------------------- 2 files changed, 23 insertions(+), 42 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 133f05d..6bb1ef1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # Changelog + All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), @@ -9,14 +10,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - `eo:cloud_cover` and `eo:snow_cover` can be used in bands -- `eo:common_name`, `eo:center_wavelength`, `eo:full_width_half_max` and `eo:solar_illumination` can be used in Assets and Item Properties +- `eo:common_name`, `eo:center_wavelength`, `eo:full_width_half_max` and `eo:solar_illumination` + can be used in Assets and Item Properties ### Changed - `eo:bands` is now using the more general `bands` construct from STAC common metadata - The following fields in the Band Object have been moved/renamed: - - `name` was *not* renamed, but has been moved to STAC common metadata - - `description` was *not* renamed, but has been moved to STAC common metadata + - `name` and `description` were *not* renamed, but have been moved to STAC common metadata - `common_name` has been renamed to `eo:common_name` - `center_wavelength` has been renamed to `eo:center_wavelength` - `full_width_half_max` has been renamed to `eo:full_width_half_max` diff --git a/json-schema/schema.json b/json-schema/schema.json index eb1e639..4728eb4 100644 --- a/json-schema/schema.json +++ b/json-schema/schema.json @@ -42,7 +42,7 @@ { "properties": { "properties": { - "$ref": "#/definitions/require_any" + "$ref": "#/definitions/require_any_or_bands" } } }, @@ -78,7 +78,7 @@ { "properties": { "summaries": { - "$ref": "#/definitions/require_any" + "$ref": "#/definitions/require_any_or_bands" } } } @@ -86,55 +86,35 @@ } ], "definitions": { - "require_any": { + "require_any_or_bands": { "anyOf": [ { - "required": [ - "eo:cloud_cover" - ] - }, - { - "required": [ - "eo:snow_cover" - ] - }, - { - "required": [ - "eo:common_name" - ] - }, - { - "required": [ - "eo:center_wavelength" - ] - }, - { - "required": [ - "eo:full_width_half_max" - ] - }, - { - "required": [ - "eo:solar_illumination" - ] + "$ref": "#/definitions/require_any" }, { "$ref": "#/definitions/require_in_bands" } ] }, + "require_any": { + "anyOf": [ + {"required": ["eo:cloud_cover"]}, + {"required": ["eo:snow_cover"]}, + {"required": ["eo:common_name"]}, + {"required": ["eo:center_wavelength"]}, + {"required": ["eo:full_width_half_max"]}, + {"required": ["eo:solar_illumination"]} + ] + }, "require_in_bands": { "required": [ "bands" ], "properties": { "bands": { - "not": { - "additionalProperties": { - "not": { - "$ref": "#/definitions/require_any" - } - } + "type": "array", + "contains": { + "$ref": "#/definitions/require_any" } } } @@ -148,7 +128,7 @@ "not": { "additionalProperties": { "not": { - "$ref": "#/definitions/require_any" + "$ref": "#/definitions/require_any_or_bands" } } } @@ -164,7 +144,7 @@ "not": { "additionalProperties": { "not": { - "$ref": "#/definitions/require_any" + "$ref": "#/definitions/require_any_or_bands" } } }