diff --git a/pystac/extensions/ext.py b/pystac/extensions/ext.py index c7a213287..95350e9bb 100644 --- a/pystac/extensions/ext.py +++ b/pystac/extensions/ext.py @@ -267,6 +267,10 @@ def table(self) -> TableExtension[T]: def view(self) -> ViewExtension[T]: return ViewExtension.ext(self.stac_object) + @property + def version(self) -> VersionExtension[T]: + return VersionExtension.ext(self.stac_object) + @dataclass class AssetExt(_AssetExt[pystac.Asset]): diff --git a/pystac/extensions/version.py b/pystac/extensions/version.py index 56490d072..d1057fab1 100644 --- a/pystac/extensions/version.py +++ b/pystac/extensions/version.py @@ -17,11 +17,11 @@ from pystac.errors import DeprecatedWarning from pystac.extensions.base import ExtensionManagementMixin, PropertiesExtension from pystac.extensions.hooks import ExtensionHooks -from pystac.utils import StringEnum, get_required, map_opt +from pystac.utils import StringEnum, map_opt -T = TypeVar("T", pystac.Collection, pystac.Item) +T = TypeVar("T", pystac.Collection, pystac.Item, pystac.Asset) -SCHEMA_URI = "https://stac-extensions.github.io/version/v1.0.0/schema.json" +SCHEMA_URI = "https://stac-extensions.github.io/version/v1.2.0/schema.json" # STAC fields - These are unusual for an extension in that they do not have # a prefix. e.g. nothing like "ver:" @@ -106,14 +106,14 @@ def apply( self.successor = successor @property - def version(self) -> str: + def version(self) -> str | None: """Get or sets a version string of the :class:`~pystac.Item` or :class:`pystac.Collection`.""" - return get_required(self._get_property(VERSION, str), self, VERSION) + return self._get_property(VERSION, str) @version.setter def version(self, v: str) -> None: - self._set_property(VERSION, v, pop_if_none=False) + self._set_property(VERSION, v, pop_if_none=True) @property def deprecated(self) -> bool | None: @@ -205,6 +205,14 @@ def successor(self, item_or_collection: T | None) -> None: ) ) + @property + def experimental(self) -> bool | None: + return self._get_property("experimental", bool) + + @experimental.setter + def experimental(self, experimental: bool) -> None: + self._set_property("experimental", experimental, pop_if_none=True) + @classmethod def get_schema_uri(cls) -> str: return SCHEMA_URI @@ -224,9 +232,12 @@ def ext(cls, obj: T, add_if_missing: bool = False) -> VersionExtension[T]: if isinstance(obj, pystac.Collection): cls.ensure_has_extension(obj, add_if_missing) return cast(VersionExtension[T], CollectionVersionExtension(obj)) - if isinstance(obj, pystac.Item): + elif isinstance(obj, pystac.Item): cls.ensure_has_extension(obj, add_if_missing) return cast(VersionExtension[T], ItemVersionExtension(obj)) + elif isinstance(obj, pystac.Asset): + cls.ensure_owner_has_extension(obj, add_if_missing) + return cast(VersionExtension[T], AssetVersionExtension(obj)) else: raise pystac.ExtensionTypeError(cls._ext_error_message(obj)) @@ -278,6 +289,29 @@ def __repr__(self) -> str: return f"" +class AssetVersionExtension(VersionExtension[pystac.Asset]): + """A concrete implementation of :class:`VersionExtension` on an + :class:`~pystac.Asset` that extends the fields of the Asset to include properties + defined in the :stac-ext:`Versioning Indicators Extension `. + + This class should generally not be instantiated directly. Instead, call + :meth:`VersionExtension.ext` on an :class:`~pystac.Asset` to extend it. + """ + + properties: dict[str, Any] + + def __init__(self, asset: pystac.Asset): + self.asset = asset + self.properties = asset.extra_fields + super().__init__(asset) + + def __repr__(self) -> str: + return ( + f"" + ) + + class VersionExtensionHooks(ExtensionHooks): schema_uri = SCHEMA_URI prev_extension_ids = {"version"} diff --git a/tests/data-files/version/collection.json b/tests/data-files/version/collection.json index 987e5f15b..7210facf4 100644 --- a/tests/data-files/version/collection.json +++ b/tests/data-files/version/collection.json @@ -1,7 +1,7 @@ { - "stac_version": "1.0.0-rc.1", + "stac_version": "1.0.0", "stac_extensions": [ - "https://stac-extensions.github.io/version/v1.0.0/schema.json" + "https://stac-extensions.github.io/version/v1.2.0/schema.json" ], "id": "merraclim", "type": "Collection", diff --git a/tests/data-files/version/item.json b/tests/data-files/version/item.json index 919f473fe..c5e6517e8 100644 --- a/tests/data-files/version/item.json +++ b/tests/data-files/version/item.json @@ -1,7 +1,7 @@ { - "stac_version": "1.0.0-rc.1", + "stac_version": "1.0.0", "stac_extensions": [ - "https://stac-extensions.github.io/version/v1.0.0/schema.json" + "https://stac-extensions.github.io/version/v1.2.0/schema.json" ], "id": "MERRAclim.2_5m_min_80s", "type": "Feature", diff --git a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_deprecated_version.yaml b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_deprecated_version.yaml index 49f3e4a4a..f1aeef37e 100644 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_deprecated_version.yaml +++ b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_deprecated_version.yaml @@ -9,74 +9,55 @@ interactions: User-Agent: - Python-urllib/3.11 method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + uri: https://stac-extensions.github.io/version/v1.2.0/schema.json response: body: string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"https://stac-extensions.github.io/version/v1.2.0/schema.json#\",\n \"title\": \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items.\",\n \"allOf\": [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n \ \"properties\",\n \"assets\"\n ],\n \"properties\": {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + \ \"properties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ },\n \"assets\": {\n \"type\": \"object\",\n + \ \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n }\n }\n }\n ]\n },\n + \ {\n \"$comment\": \"This is the schema for STAC Collections.\",\n + \ \"type\": \"object\",\n \"allOf\": [\n {\n \"required\": + [\n \"type\"\n ],\n \"properties\": {\n \"type\": + {\n \"const\": \"Collection\"\n }\n }\n },\n + \ {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection.\",\n \"allOf\": [\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n },\n {\n + \ \"$comment\": \"This validates the fields in Collection Assets.\",\n + \ \"properties\": {\n \"assets\": {\n \"type\": + \"object\",\n \"additionalProperties\": {\n \"$ref\": + \"#/definitions/fields\"\n }\n }\n }\n },\n + \ {\n \"$comment\": \"This is the schema for the fields in + Item Asset Definitions.\",\n \"properties\": {\n \"item_assets\": + {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n + is the schema for STAC Catalog.\",\n \"allOf\": [\n {\n \"type\": + \"object\",\n \"required\": [\n \"type\"\n ],\n \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$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.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$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.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + \"Catalog\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n },\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n }\n ],\n \"definitions\": {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \"https://stac-extensions.github.io/version/v1.2.0/schema.json\"\n }\n + \ }\n }\n },\n \"fields\": {\n \"type\": \"object\",\n + \ \"properties\": {\n \"version\": {\n \"type\": \"string\",\n + \ \"title\": \"Version\"\n },\n \"deprecated\": {\n + \ \"type\": \"boolean\",\n \"title\": \"Deprecated\",\n \"default\": + false\n },\n \"experimental\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Experimental\",\n \"default\": false\n }\n \ }\n }\n }\n}\n" headers: Accept-Ranges: @@ -84,19 +65,19 @@ interactions: Access-Control-Allow-Origin: - '*' Age: - - '517' + - '443' Cache-Control: - max-age=600 Connection: - close Content-Length: - - '5009' + - '3405' Content-Type: - application/json; charset=utf-8 Date: - - Wed, 27 Sep 2023 21:20:50 GMT + - Fri, 13 Oct 2023 13:39:13 GMT ETag: - - '"645249bd-1391"' + - '"645249bd-d4d"' Last-Modified: - Wed, 03 May 2023 11:47:09 GMT Server: @@ -110,17 +91,17 @@ interactions: X-Cache: - HIT X-Cache-Hits: - - '2' + - '1' X-Fastly-Request-ID: - - 8b9fffd9434fd81ec501ce6f8c825aa774cc06e7 + - 8ba7479ba4057d23836c2d204c3baeda68d2722f X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC + - B200:2C1D:709A53:995830:6529359A X-Served-By: - - cache-lga21962-LGA + - cache-iad-kjyo7100036-IAD X-Timer: - - S1695849651.615996,VS0,VE1 + - S1697204353.008353,VS0,VE1 expires: - - Wed, 27 Sep 2023 21:22:13 GMT + - Fri, 13 Oct 2023 12:28:35 GMT permissions-policy: - interest-cohort=() x-proxy-cache: diff --git a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_not_deprecated_version.yaml b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_not_deprecated_version.yaml index aa857cea1..a4a0bf1a1 100644 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_not_deprecated_version.yaml +++ b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_not_deprecated_version.yaml @@ -9,74 +9,55 @@ interactions: User-Agent: - Python-urllib/3.11 method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + uri: https://stac-extensions.github.io/version/v1.2.0/schema.json response: body: string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"https://stac-extensions.github.io/version/v1.2.0/schema.json#\",\n \"title\": \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items.\",\n \"allOf\": [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n \ \"properties\",\n \"assets\"\n ],\n \"properties\": {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + \ \"properties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ },\n \"assets\": {\n \"type\": \"object\",\n + \ \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n }\n }\n }\n ]\n },\n + \ {\n \"$comment\": \"This is the schema for STAC Collections.\",\n + \ \"type\": \"object\",\n \"allOf\": [\n {\n \"required\": + [\n \"type\"\n ],\n \"properties\": {\n \"type\": + {\n \"const\": \"Collection\"\n }\n }\n },\n + \ {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection.\",\n \"allOf\": [\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n },\n {\n + \ \"$comment\": \"This validates the fields in Collection Assets.\",\n + \ \"properties\": {\n \"assets\": {\n \"type\": + \"object\",\n \"additionalProperties\": {\n \"$ref\": + \"#/definitions/fields\"\n }\n }\n }\n },\n + \ {\n \"$comment\": \"This is the schema for the fields in + Item Asset Definitions.\",\n \"properties\": {\n \"item_assets\": + {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n + is the schema for STAC Catalog.\",\n \"allOf\": [\n {\n \"type\": + \"object\",\n \"required\": [\n \"type\"\n ],\n \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$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.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$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.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + \"Catalog\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n },\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n }\n ],\n \"definitions\": {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \"https://stac-extensions.github.io/version/v1.2.0/schema.json\"\n }\n + \ }\n }\n },\n \"fields\": {\n \"type\": \"object\",\n + \ \"properties\": {\n \"version\": {\n \"type\": \"string\",\n + \ \"title\": \"Version\"\n },\n \"deprecated\": {\n + \ \"type\": \"boolean\",\n \"title\": \"Deprecated\",\n \"default\": + false\n },\n \"experimental\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Experimental\",\n \"default\": false\n }\n \ }\n }\n }\n}\n" headers: Accept-Ranges: @@ -84,19 +65,19 @@ interactions: Access-Control-Allow-Origin: - '*' Age: - - '517' + - '443' Cache-Control: - max-age=600 Connection: - close Content-Length: - - '5009' + - '3405' Content-Type: - application/json; charset=utf-8 Date: - - Wed, 27 Sep 2023 21:20:50 GMT + - Fri, 13 Oct 2023 13:39:13 GMT ETag: - - '"645249bd-1391"' + - '"645249bd-d4d"' Last-Modified: - Wed, 03 May 2023 11:47:09 GMT Server: @@ -112,15 +93,15 @@ interactions: X-Cache-Hits: - '1' X-Fastly-Request-ID: - - 5cc8b1daa791094130bd3d647375872983c7a593 + - abcccf2400afc920fdba94c45b5f1ba27042c237 X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC + - B200:2C1D:709A53:995830:6529359A X-Served-By: - - cache-lga21944-LGA + - cache-iad-kjyo7100146-IAD X-Timer: - - S1695849651.744949,VS0,VE2 + - S1697204353.136160,VS0,VE1 expires: - - Wed, 27 Sep 2023 21:22:13 GMT + - Fri, 13 Oct 2023 12:28:35 GMT permissions-policy: - interest-cohort=() x-proxy-cache: diff --git a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_version.yaml b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_version.yaml index b34cffd5a..e20264fe5 100644 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_version.yaml +++ b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_version.yaml @@ -9,74 +9,55 @@ interactions: User-Agent: - Python-urllib/3.11 method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + uri: https://stac-extensions.github.io/version/v1.2.0/schema.json response: body: string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"https://stac-extensions.github.io/version/v1.2.0/schema.json#\",\n \"title\": \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items.\",\n \"allOf\": [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n \ \"properties\",\n \"assets\"\n ],\n \"properties\": {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + \ \"properties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ },\n \"assets\": {\n \"type\": \"object\",\n + \ \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n }\n }\n }\n ]\n },\n + \ {\n \"$comment\": \"This is the schema for STAC Collections.\",\n + \ \"type\": \"object\",\n \"allOf\": [\n {\n \"required\": + [\n \"type\"\n ],\n \"properties\": {\n \"type\": + {\n \"const\": \"Collection\"\n }\n }\n },\n + \ {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection.\",\n \"allOf\": [\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n },\n {\n + \ \"$comment\": \"This validates the fields in Collection Assets.\",\n + \ \"properties\": {\n \"assets\": {\n \"type\": + \"object\",\n \"additionalProperties\": {\n \"$ref\": + \"#/definitions/fields\"\n }\n }\n }\n },\n + \ {\n \"$comment\": \"This is the schema for the fields in + Item Asset Definitions.\",\n \"properties\": {\n \"item_assets\": + {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n + is the schema for STAC Catalog.\",\n \"allOf\": [\n {\n \"type\": + \"object\",\n \"required\": [\n \"type\"\n ],\n \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$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.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$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.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + \"Catalog\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n },\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n }\n ],\n \"definitions\": {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \"https://stac-extensions.github.io/version/v1.2.0/schema.json\"\n }\n + \ }\n }\n },\n \"fields\": {\n \"type\": \"object\",\n + \ \"properties\": {\n \"version\": {\n \"type\": \"string\",\n + \ \"title\": \"Version\"\n },\n \"deprecated\": {\n + \ \"type\": \"boolean\",\n \"title\": \"Deprecated\",\n \"default\": + false\n },\n \"experimental\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Experimental\",\n \"default\": false\n }\n \ }\n }\n }\n}\n" headers: Accept-Ranges: @@ -84,19 +65,19 @@ interactions: Access-Control-Allow-Origin: - '*' Age: - - '517' + - '443' Cache-Control: - max-age=600 Connection: - close Content-Length: - - '5009' + - '3405' Content-Type: - application/json; charset=utf-8 Date: - - Wed, 27 Sep 2023 21:20:50 GMT + - Fri, 13 Oct 2023 13:39:13 GMT ETag: - - '"645249bd-1391"' + - '"645249bd-d4d"' Last-Modified: - Wed, 03 May 2023 11:47:09 GMT Server: @@ -110,17 +91,17 @@ interactions: X-Cache: - HIT X-Cache-Hits: - - '2' + - '1' X-Fastly-Request-ID: - - d51a0034913bcb87930977d18078ba0ed2552e2a + - 238d77e4f04daa877cd9ddf7e410f794036a6391 X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC + - B200:2C1D:709A53:995830:6529359A X-Served-By: - - cache-lga21944-LGA + - cache-iad-kjyo7100066-IAD X-Timer: - - S1695849651.859898,VS0,VE1 + - S1697204353.272924,VS0,VE1 expires: - - Wed, 27 Sep 2023 21:22:13 GMT + - Fri, 13 Oct 2023 12:28:35 GMT permissions-policy: - interest-cohort=() x-proxy-cache: diff --git a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_fail_validate.yaml b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_fail_validate.yaml index 1089f9093..1b4401339 100644 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_fail_validate.yaml +++ b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_fail_validate.yaml @@ -9,74 +9,55 @@ interactions: User-Agent: - Python-urllib/3.11 method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + uri: https://stac-extensions.github.io/version/v1.2.0/schema.json response: body: string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"https://stac-extensions.github.io/version/v1.2.0/schema.json#\",\n \"title\": \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items.\",\n \"allOf\": [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n \ \"properties\",\n \"assets\"\n ],\n \"properties\": {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + \ \"properties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ },\n \"assets\": {\n \"type\": \"object\",\n + \ \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n }\n }\n }\n ]\n },\n + \ {\n \"$comment\": \"This is the schema for STAC Collections.\",\n + \ \"type\": \"object\",\n \"allOf\": [\n {\n \"required\": + [\n \"type\"\n ],\n \"properties\": {\n \"type\": + {\n \"const\": \"Collection\"\n }\n }\n },\n + \ {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection.\",\n \"allOf\": [\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n },\n {\n + \ \"$comment\": \"This validates the fields in Collection Assets.\",\n + \ \"properties\": {\n \"assets\": {\n \"type\": + \"object\",\n \"additionalProperties\": {\n \"$ref\": + \"#/definitions/fields\"\n }\n }\n }\n },\n + \ {\n \"$comment\": \"This is the schema for the fields in + Item Asset Definitions.\",\n \"properties\": {\n \"item_assets\": + {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n + is the schema for STAC Catalog.\",\n \"allOf\": [\n {\n \"type\": + \"object\",\n \"required\": [\n \"type\"\n ],\n \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$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.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$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.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + \"Catalog\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n },\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n }\n ],\n \"definitions\": {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \"https://stac-extensions.github.io/version/v1.2.0/schema.json\"\n }\n + \ }\n }\n },\n \"fields\": {\n \"type\": \"object\",\n + \ \"properties\": {\n \"version\": {\n \"type\": \"string\",\n + \ \"title\": \"Version\"\n },\n \"deprecated\": {\n + \ \"type\": \"boolean\",\n \"title\": \"Deprecated\",\n \"default\": + false\n },\n \"experimental\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Experimental\",\n \"default\": false\n }\n \ }\n }\n }\n}\n" headers: Accept-Ranges: @@ -84,19 +65,19 @@ interactions: Access-Control-Allow-Origin: - '*' Age: - - '517' + - '443' Cache-Control: - max-age=600 Connection: - close Content-Length: - - '5009' + - '3405' Content-Type: - application/json; charset=utf-8 Date: - - Wed, 27 Sep 2023 21:20:50 GMT + - Fri, 13 Oct 2023 13:39:13 GMT ETag: - - '"645249bd-1391"' + - '"645249bd-d4d"' Last-Modified: - Wed, 03 May 2023 11:47:09 GMT Server: @@ -112,15 +93,15 @@ interactions: X-Cache-Hits: - '1' X-Fastly-Request-ID: - - 8aa620895428e2051aaaba178500112e064afcd1 + - 607029835f8399b0b0cefe161e176ee906334861 X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC + - B200:2C1D:709A53:995830:6529359A X-Served-By: - - cache-lga21935-LGA + - cache-iad-kjyo7100174-IAD X-Timer: - - S1695849651.980769,VS0,VE11 + - S1697204353.400194,VS0,VE5 expires: - - Wed, 27 Sep 2023 21:22:13 GMT + - Fri, 13 Oct 2023 12:28:35 GMT permissions-policy: - interest-cohort=() x-proxy-cache: diff --git a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_latest.yaml b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_latest.yaml index b7f65b084..34eecdfcb 100644 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_latest.yaml +++ b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_latest.yaml @@ -9,74 +9,55 @@ interactions: User-Agent: - Python-urllib/3.11 method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + uri: https://stac-extensions.github.io/version/v1.2.0/schema.json response: body: string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"https://stac-extensions.github.io/version/v1.2.0/schema.json#\",\n \"title\": \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items.\",\n \"allOf\": [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n \ \"properties\",\n \"assets\"\n ],\n \"properties\": {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + \ \"properties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ },\n \"assets\": {\n \"type\": \"object\",\n + \ \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n }\n }\n }\n ]\n },\n + \ {\n \"$comment\": \"This is the schema for STAC Collections.\",\n + \ \"type\": \"object\",\n \"allOf\": [\n {\n \"required\": + [\n \"type\"\n ],\n \"properties\": {\n \"type\": + {\n \"const\": \"Collection\"\n }\n }\n },\n + \ {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection.\",\n \"allOf\": [\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n },\n {\n + \ \"$comment\": \"This validates the fields in Collection Assets.\",\n + \ \"properties\": {\n \"assets\": {\n \"type\": + \"object\",\n \"additionalProperties\": {\n \"$ref\": + \"#/definitions/fields\"\n }\n }\n }\n },\n + \ {\n \"$comment\": \"This is the schema for the fields in + Item Asset Definitions.\",\n \"properties\": {\n \"item_assets\": + {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n + is the schema for STAC Catalog.\",\n \"allOf\": [\n {\n \"type\": + \"object\",\n \"required\": [\n \"type\"\n ],\n \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$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.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$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.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + \"Catalog\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n },\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n }\n ],\n \"definitions\": {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \"https://stac-extensions.github.io/version/v1.2.0/schema.json\"\n }\n + \ }\n }\n },\n \"fields\": {\n \"type\": \"object\",\n + \ \"properties\": {\n \"version\": {\n \"type\": \"string\",\n + \ \"title\": \"Version\"\n },\n \"deprecated\": {\n + \ \"type\": \"boolean\",\n \"title\": \"Deprecated\",\n \"default\": + false\n },\n \"experimental\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Experimental\",\n \"default\": false\n }\n \ }\n }\n }\n}\n" headers: Accept-Ranges: @@ -84,19 +65,19 @@ interactions: Access-Control-Allow-Origin: - '*' Age: - - '518' + - '444' Cache-Control: - max-age=600 Connection: - close Content-Length: - - '5009' + - '3405' Content-Type: - application/json; charset=utf-8 Date: - - Wed, 27 Sep 2023 21:20:51 GMT + - Fri, 13 Oct 2023 13:39:13 GMT ETag: - - '"645249bd-1391"' + - '"645249bd-d4d"' Last-Modified: - Wed, 03 May 2023 11:47:09 GMT Server: @@ -110,17 +91,17 @@ interactions: X-Cache: - HIT X-Cache-Hits: - - '2' + - '1' X-Fastly-Request-ID: - - c68fdd17099afeb9fa2a41aaad460ada72e07f58 + - 96f541bdee3a4b7cd89112fe04c93a6259227004 X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC + - B200:2C1D:709A53:995830:6529359A X-Served-By: - - cache-lga21953-LGA + - cache-iad-kjyo7100097-IAD X-Timer: - - S1695849651.160246,VS0,VE1 + - S1697204354.684733,VS0,VE1 expires: - - Wed, 27 Sep 2023 21:22:13 GMT + - Fri, 13 Oct 2023 12:28:35 GMT permissions-policy: - interest-cohort=() x-proxy-cache: diff --git a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_predecessor.yaml b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_predecessor.yaml index c6838680c..6419fdf69 100644 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_predecessor.yaml +++ b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_predecessor.yaml @@ -9,74 +9,55 @@ interactions: User-Agent: - Python-urllib/3.11 method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + uri: https://stac-extensions.github.io/version/v1.2.0/schema.json response: body: string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"https://stac-extensions.github.io/version/v1.2.0/schema.json#\",\n \"title\": \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items.\",\n \"allOf\": [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n \ \"properties\",\n \"assets\"\n ],\n \"properties\": {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + \ \"properties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ },\n \"assets\": {\n \"type\": \"object\",\n + \ \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n }\n }\n }\n ]\n },\n + \ {\n \"$comment\": \"This is the schema for STAC Collections.\",\n + \ \"type\": \"object\",\n \"allOf\": [\n {\n \"required\": + [\n \"type\"\n ],\n \"properties\": {\n \"type\": + {\n \"const\": \"Collection\"\n }\n }\n },\n + \ {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection.\",\n \"allOf\": [\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n },\n {\n + \ \"$comment\": \"This validates the fields in Collection Assets.\",\n + \ \"properties\": {\n \"assets\": {\n \"type\": + \"object\",\n \"additionalProperties\": {\n \"$ref\": + \"#/definitions/fields\"\n }\n }\n }\n },\n + \ {\n \"$comment\": \"This is the schema for the fields in + Item Asset Definitions.\",\n \"properties\": {\n \"item_assets\": + {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n + is the schema for STAC Catalog.\",\n \"allOf\": [\n {\n \"type\": + \"object\",\n \"required\": [\n \"type\"\n ],\n \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$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.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$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.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + \"Catalog\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n },\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n }\n ],\n \"definitions\": {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \"https://stac-extensions.github.io/version/v1.2.0/schema.json\"\n }\n + \ }\n }\n },\n \"fields\": {\n \"type\": \"object\",\n + \ \"properties\": {\n \"version\": {\n \"type\": \"string\",\n + \ \"title\": \"Version\"\n },\n \"deprecated\": {\n + \ \"type\": \"boolean\",\n \"title\": \"Deprecated\",\n \"default\": + false\n },\n \"experimental\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Experimental\",\n \"default\": false\n }\n \ }\n }\n }\n}\n" headers: Accept-Ranges: @@ -84,19 +65,19 @@ interactions: Access-Control-Allow-Origin: - '*' Age: - - '518' + - '444' Cache-Control: - max-age=600 Connection: - close Content-Length: - - '5009' + - '3405' Content-Type: - application/json; charset=utf-8 Date: - - Wed, 27 Sep 2023 21:20:51 GMT + - Fri, 13 Oct 2023 13:39:13 GMT ETag: - - '"645249bd-1391"' + - '"645249bd-d4d"' Last-Modified: - Wed, 03 May 2023 11:47:09 GMT Server: @@ -110,17 +91,17 @@ interactions: X-Cache: - HIT X-Cache-Hits: - - '1' + - '2' X-Fastly-Request-ID: - - 461d7b8b0785d9d7b5ad98442cb43bb2cfc1b5d5 + - 3ce057d669b856c979d50557bf3b705ccb034236 X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC + - B200:2C1D:709A53:995830:6529359A X-Served-By: - - cache-lga21952-LGA + - cache-iad-kjyo7100069-IAD X-Timer: - - S1695849651.289445,VS0,VE2 + - S1697204354.805436,VS0,VE0 expires: - - Wed, 27 Sep 2023 21:22:13 GMT + - Fri, 13 Oct 2023 12:28:35 GMT permissions-policy: - interest-cohort=() x-proxy-cache: diff --git a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_successor.yaml b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_successor.yaml index cfc6c7dbf..22379e7bb 100644 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_successor.yaml +++ b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_successor.yaml @@ -9,74 +9,55 @@ interactions: User-Agent: - Python-urllib/3.11 method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + uri: https://stac-extensions.github.io/version/v1.2.0/schema.json response: body: string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"https://stac-extensions.github.io/version/v1.2.0/schema.json#\",\n \"title\": \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items.\",\n \"allOf\": [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n \ \"properties\",\n \"assets\"\n ],\n \"properties\": {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + \ \"properties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ },\n \"assets\": {\n \"type\": \"object\",\n + \ \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n }\n }\n }\n ]\n },\n + \ {\n \"$comment\": \"This is the schema for STAC Collections.\",\n + \ \"type\": \"object\",\n \"allOf\": [\n {\n \"required\": + [\n \"type\"\n ],\n \"properties\": {\n \"type\": + {\n \"const\": \"Collection\"\n }\n }\n },\n + \ {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection.\",\n \"allOf\": [\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n },\n {\n + \ \"$comment\": \"This validates the fields in Collection Assets.\",\n + \ \"properties\": {\n \"assets\": {\n \"type\": + \"object\",\n \"additionalProperties\": {\n \"$ref\": + \"#/definitions/fields\"\n }\n }\n }\n },\n + \ {\n \"$comment\": \"This is the schema for the fields in + Item Asset Definitions.\",\n \"properties\": {\n \"item_assets\": + {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n + is the schema for STAC Catalog.\",\n \"allOf\": [\n {\n \"type\": + \"object\",\n \"required\": [\n \"type\"\n ],\n \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$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.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$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.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + \"Catalog\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n },\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n }\n ],\n \"definitions\": {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \"https://stac-extensions.github.io/version/v1.2.0/schema.json\"\n }\n + \ }\n }\n },\n \"fields\": {\n \"type\": \"object\",\n + \ \"properties\": {\n \"version\": {\n \"type\": \"string\",\n + \ \"title\": \"Version\"\n },\n \"deprecated\": {\n + \ \"type\": \"boolean\",\n \"title\": \"Deprecated\",\n \"default\": + false\n },\n \"experimental\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Experimental\",\n \"default\": false\n }\n \ }\n }\n }\n}\n" headers: Accept-Ranges: @@ -84,19 +65,19 @@ interactions: Access-Control-Allow-Origin: - '*' Age: - - '518' + - '444' Cache-Control: - max-age=600 Connection: - close Content-Length: - - '5009' + - '3405' Content-Type: - application/json; charset=utf-8 Date: - - Wed, 27 Sep 2023 21:20:51 GMT + - Fri, 13 Oct 2023 13:39:13 GMT ETag: - - '"645249bd-1391"' + - '"645249bd-d4d"' Last-Modified: - Wed, 03 May 2023 11:47:09 GMT Server: @@ -112,15 +93,15 @@ interactions: X-Cache-Hits: - '1' X-Fastly-Request-ID: - - f0d6b9a4385e311b102ff903774db54d649a26a7 + - 2d30b45c94ccf4e8cede9c58ce024e565fe965ab X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC + - B200:2C1D:709A53:995830:6529359A X-Served-By: - - cache-lga21968-LGA + - cache-iad-kjyo7100025-IAD X-Timer: - - S1695849651.421971,VS0,VE2 + - S1697204354.932412,VS0,VE1 expires: - - Wed, 27 Sep 2023 21:22:13 GMT + - Fri, 13 Oct 2023 12:28:35 GMT permissions-policy: - interest-cohort=() x-proxy-cache: diff --git a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_validate_all.yaml b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_validate_all.yaml index d2b4e44a7..6c5c04d36 100644 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_validate_all.yaml +++ b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_validate_all.yaml @@ -9,74 +9,55 @@ interactions: User-Agent: - Python-urllib/3.11 method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + uri: https://stac-extensions.github.io/version/v1.2.0/schema.json response: body: string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"https://stac-extensions.github.io/version/v1.2.0/schema.json#\",\n \"title\": \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items.\",\n \"allOf\": [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n \ \"properties\",\n \"assets\"\n ],\n \"properties\": {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + \ \"properties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ },\n \"assets\": {\n \"type\": \"object\",\n + \ \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n }\n }\n }\n ]\n },\n + \ {\n \"$comment\": \"This is the schema for STAC Collections.\",\n + \ \"type\": \"object\",\n \"allOf\": [\n {\n \"required\": + [\n \"type\"\n ],\n \"properties\": {\n \"type\": + {\n \"const\": \"Collection\"\n }\n }\n },\n + \ {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection.\",\n \"allOf\": [\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n },\n {\n + \ \"$comment\": \"This validates the fields in Collection Assets.\",\n + \ \"properties\": {\n \"assets\": {\n \"type\": + \"object\",\n \"additionalProperties\": {\n \"$ref\": + \"#/definitions/fields\"\n }\n }\n }\n },\n + \ {\n \"$comment\": \"This is the schema for the fields in + Item Asset Definitions.\",\n \"properties\": {\n \"item_assets\": + {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n + is the schema for STAC Catalog.\",\n \"allOf\": [\n {\n \"type\": + \"object\",\n \"required\": [\n \"type\"\n ],\n \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$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.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$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.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + \"Catalog\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n },\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n }\n ],\n \"definitions\": {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \"https://stac-extensions.github.io/version/v1.2.0/schema.json\"\n }\n + \ }\n }\n },\n \"fields\": {\n \"type\": \"object\",\n + \ \"properties\": {\n \"version\": {\n \"type\": \"string\",\n + \ \"title\": \"Version\"\n },\n \"deprecated\": {\n + \ \"type\": \"boolean\",\n \"title\": \"Deprecated\",\n \"default\": + false\n },\n \"experimental\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Experimental\",\n \"default\": false\n }\n \ }\n }\n }\n}\n" headers: Accept-Ranges: @@ -84,19 +65,19 @@ interactions: Access-Control-Allow-Origin: - '*' Age: - - '518' + - '444' Cache-Control: - max-age=600 Connection: - close Content-Length: - - '5009' + - '3405' Content-Type: - application/json; charset=utf-8 Date: - - Wed, 27 Sep 2023 21:20:51 GMT + - Fri, 13 Oct 2023 13:39:14 GMT ETag: - - '"645249bd-1391"' + - '"645249bd-d4d"' Last-Modified: - Wed, 03 May 2023 11:47:09 GMT Server: @@ -112,15 +93,15 @@ interactions: X-Cache-Hits: - '1' X-Fastly-Request-ID: - - bab94633646923df71cc7974a517a2f291754c77 + - 861e7c109b14630c4cc451acda2afd01154e633c X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC + - B200:2C1D:709A53:995830:6529359A X-Served-By: - - cache-lga21973-LGA + - cache-iad-kjyo7100163-IAD X-Timer: - - S1695849652.572206,VS0,VE2 + - S1697204354.054689,VS0,VE5 expires: - - Wed, 27 Sep 2023 21:22:13 GMT + - Fri, 13 Oct 2023 12:28:35 GMT permissions-policy: - interest-cohort=() x-proxy-cache: diff --git a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_version_deprecated.yaml b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_version_deprecated.yaml index 042b9562a..2e5f7eb9b 100644 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_version_deprecated.yaml +++ b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_version_deprecated.yaml @@ -9,74 +9,55 @@ interactions: User-Agent: - Python-urllib/3.11 method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + uri: https://stac-extensions.github.io/version/v1.2.0/schema.json response: body: string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"https://stac-extensions.github.io/version/v1.2.0/schema.json#\",\n \"title\": \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items.\",\n \"allOf\": [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n \ \"properties\",\n \"assets\"\n ],\n \"properties\": {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + \ \"properties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ },\n \"assets\": {\n \"type\": \"object\",\n + \ \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n }\n }\n }\n ]\n },\n + \ {\n \"$comment\": \"This is the schema for STAC Collections.\",\n + \ \"type\": \"object\",\n \"allOf\": [\n {\n \"required\": + [\n \"type\"\n ],\n \"properties\": {\n \"type\": + {\n \"const\": \"Collection\"\n }\n }\n },\n + \ {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection.\",\n \"allOf\": [\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n },\n {\n + \ \"$comment\": \"This validates the fields in Collection Assets.\",\n + \ \"properties\": {\n \"assets\": {\n \"type\": + \"object\",\n \"additionalProperties\": {\n \"$ref\": + \"#/definitions/fields\"\n }\n }\n }\n },\n + \ {\n \"$comment\": \"This is the schema for the fields in + Item Asset Definitions.\",\n \"properties\": {\n \"item_assets\": + {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n + is the schema for STAC Catalog.\",\n \"allOf\": [\n {\n \"type\": + \"object\",\n \"required\": [\n \"type\"\n ],\n \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$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.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$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.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + \"Catalog\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n },\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n }\n ],\n \"definitions\": {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \"https://stac-extensions.github.io/version/v1.2.0/schema.json\"\n }\n + \ }\n }\n },\n \"fields\": {\n \"type\": \"object\",\n + \ \"properties\": {\n \"version\": {\n \"type\": \"string\",\n + \ \"title\": \"Version\"\n },\n \"deprecated\": {\n + \ \"type\": \"boolean\",\n \"title\": \"Deprecated\",\n \"default\": + false\n },\n \"experimental\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Experimental\",\n \"default\": false\n }\n \ }\n }\n }\n}\n" headers: Accept-Ranges: @@ -84,19 +65,19 @@ interactions: Access-Control-Allow-Origin: - '*' Age: - - '518' + - '444' Cache-Control: - max-age=600 Connection: - close Content-Length: - - '5009' + - '3405' Content-Type: - application/json; charset=utf-8 Date: - - Wed, 27 Sep 2023 21:20:51 GMT + - Fri, 13 Oct 2023 13:39:14 GMT ETag: - - '"645249bd-1391"' + - '"645249bd-d4d"' Last-Modified: - Wed, 03 May 2023 11:47:09 GMT Server: @@ -112,15 +93,15 @@ interactions: X-Cache-Hits: - '1' X-Fastly-Request-ID: - - b9a3c67614808f15330b3f58d48c3cccd713e625 + - 151634a53598a40b84a36848b45e98fca574a7d7 X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC + - B200:2C1D:709A53:995830:6529359A X-Served-By: - - cache-lga21954-LGA + - cache-iad-kjyo7100144-IAD X-Timer: - - S1695849652.706984,VS0,VE2 + - S1697204354.164527,VS0,VE5 expires: - - Wed, 27 Sep 2023 21:22:13 GMT + - Fri, 13 Oct 2023 12:28:35 GMT permissions-policy: - interest-cohort=() x-proxy-cache: diff --git a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_deprecated_version.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_deprecated_version.yaml index 81c865b80..b7c9ce522 100644 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_deprecated_version.yaml +++ b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_deprecated_version.yaml @@ -9,74 +9,55 @@ interactions: User-Agent: - Python-urllib/3.11 method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + uri: https://stac-extensions.github.io/version/v1.2.0/schema.json response: body: string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"https://stac-extensions.github.io/version/v1.2.0/schema.json#\",\n \"title\": \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items.\",\n \"allOf\": [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n \ \"properties\",\n \"assets\"\n ],\n \"properties\": {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + \ \"properties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ },\n \"assets\": {\n \"type\": \"object\",\n + \ \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n }\n }\n }\n ]\n },\n + \ {\n \"$comment\": \"This is the schema for STAC Collections.\",\n + \ \"type\": \"object\",\n \"allOf\": [\n {\n \"required\": + [\n \"type\"\n ],\n \"properties\": {\n \"type\": + {\n \"const\": \"Collection\"\n }\n }\n },\n + \ {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection.\",\n \"allOf\": [\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n },\n {\n + \ \"$comment\": \"This validates the fields in Collection Assets.\",\n + \ \"properties\": {\n \"assets\": {\n \"type\": + \"object\",\n \"additionalProperties\": {\n \"$ref\": + \"#/definitions/fields\"\n }\n }\n }\n },\n + \ {\n \"$comment\": \"This is the schema for the fields in + Item Asset Definitions.\",\n \"properties\": {\n \"item_assets\": + {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n + is the schema for STAC Catalog.\",\n \"allOf\": [\n {\n \"type\": + \"object\",\n \"required\": [\n \"type\"\n ],\n \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$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.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$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.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + \"Catalog\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n },\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n }\n ],\n \"definitions\": {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \"https://stac-extensions.github.io/version/v1.2.0/schema.json\"\n }\n + \ }\n }\n },\n \"fields\": {\n \"type\": \"object\",\n + \ \"properties\": {\n \"version\": {\n \"type\": \"string\",\n + \ \"title\": \"Version\"\n },\n \"deprecated\": {\n + \ \"type\": \"boolean\",\n \"title\": \"Deprecated\",\n \"default\": + false\n },\n \"experimental\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Experimental\",\n \"default\": false\n }\n \ }\n }\n }\n}\n" headers: Accept-Ranges: @@ -84,19 +65,19 @@ interactions: Access-Control-Allow-Origin: - '*' Age: - - '516' + - '442' Cache-Control: - max-age=600 Connection: - close Content-Length: - - '5009' + - '3405' Content-Type: - application/json; charset=utf-8 Date: - - Wed, 27 Sep 2023 21:20:49 GMT + - Fri, 13 Oct 2023 13:39:11 GMT ETag: - - '"645249bd-1391"' + - '"645249bd-d4d"' Last-Modified: - Wed, 03 May 2023 11:47:09 GMT Server: @@ -112,15 +93,15 @@ interactions: X-Cache-Hits: - '1' X-Fastly-Request-ID: - - 8d49cb7e72d6110e2197d72dfcccd36016b39459 + - 2b60729775b9f7c09ce378235ab9db24a0f28620 X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC + - B200:2C1D:709A53:995830:6529359A X-Served-By: - - cache-lga21971-LGA + - cache-iad-kjyo7100124-IAD X-Timer: - - S1695849649.351212,VS0,VE1 + - S1697204352.787468,VS0,VE4 expires: - - Wed, 27 Sep 2023 21:22:13 GMT + - Fri, 13 Oct 2023 12:28:35 GMT permissions-policy: - interest-cohort=() x-proxy-cache: diff --git a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_not_deprecated_version.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_not_deprecated_version.yaml index 1016aaa26..06874be72 100644 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_not_deprecated_version.yaml +++ b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_not_deprecated_version.yaml @@ -9,74 +9,55 @@ interactions: User-Agent: - Python-urllib/3.11 method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + uri: https://stac-extensions.github.io/version/v1.2.0/schema.json response: body: string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"https://stac-extensions.github.io/version/v1.2.0/schema.json#\",\n \"title\": \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items.\",\n \"allOf\": [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n \ \"properties\",\n \"assets\"\n ],\n \"properties\": {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + \ \"properties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ },\n \"assets\": {\n \"type\": \"object\",\n + \ \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n }\n }\n }\n ]\n },\n + \ {\n \"$comment\": \"This is the schema for STAC Collections.\",\n + \ \"type\": \"object\",\n \"allOf\": [\n {\n \"required\": + [\n \"type\"\n ],\n \"properties\": {\n \"type\": + {\n \"const\": \"Collection\"\n }\n }\n },\n + \ {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection.\",\n \"allOf\": [\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n },\n {\n + \ \"$comment\": \"This validates the fields in Collection Assets.\",\n + \ \"properties\": {\n \"assets\": {\n \"type\": + \"object\",\n \"additionalProperties\": {\n \"$ref\": + \"#/definitions/fields\"\n }\n }\n }\n },\n + \ {\n \"$comment\": \"This is the schema for the fields in + Item Asset Definitions.\",\n \"properties\": {\n \"item_assets\": + {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n + is the schema for STAC Catalog.\",\n \"allOf\": [\n {\n \"type\": + \"object\",\n \"required\": [\n \"type\"\n ],\n \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$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.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$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.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + \"Catalog\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n },\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n }\n ],\n \"definitions\": {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \"https://stac-extensions.github.io/version/v1.2.0/schema.json\"\n }\n + \ }\n }\n },\n \"fields\": {\n \"type\": \"object\",\n + \ \"properties\": {\n \"version\": {\n \"type\": \"string\",\n + \ \"title\": \"Version\"\n },\n \"deprecated\": {\n + \ \"type\": \"boolean\",\n \"title\": \"Deprecated\",\n \"default\": + false\n },\n \"experimental\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Experimental\",\n \"default\": false\n }\n \ }\n }\n }\n}\n" headers: Accept-Ranges: @@ -84,19 +65,19 @@ interactions: Access-Control-Allow-Origin: - '*' Age: - - '516' + - '442' Cache-Control: - max-age=600 Connection: - close Content-Length: - - '5009' + - '3405' Content-Type: - application/json; charset=utf-8 Date: - - Wed, 27 Sep 2023 21:20:49 GMT + - Fri, 13 Oct 2023 13:39:11 GMT ETag: - - '"645249bd-1391"' + - '"645249bd-d4d"' Last-Modified: - Wed, 03 May 2023 11:47:09 GMT Server: @@ -112,15 +93,15 @@ interactions: X-Cache-Hits: - '1' X-Fastly-Request-ID: - - 0d1710c11f74dd885ed23c36249d7cc7a99f4f60 + - 163f65f31b1a2e9919f8c598fc13bd9385f6ade9 X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC + - B200:2C1D:709A53:995830:6529359A X-Served-By: - - cache-lga21938-LGA + - cache-iad-kjyo7100150-IAD X-Timer: - - S1695849649.472479,VS0,VE2 + - S1697204352.914136,VS0,VE1 expires: - - Wed, 27 Sep 2023 21:22:13 GMT + - Fri, 13 Oct 2023 12:28:35 GMT permissions-policy: - interest-cohort=() x-proxy-cache: diff --git a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_version.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_version.yaml index 62102665e..95878e520 100644 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_version.yaml +++ b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_version.yaml @@ -9,74 +9,55 @@ interactions: User-Agent: - Python-urllib/3.11 method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + uri: https://stac-extensions.github.io/version/v1.2.0/schema.json response: body: string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"https://stac-extensions.github.io/version/v1.2.0/schema.json#\",\n \"title\": \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items.\",\n \"allOf\": [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n \ \"properties\",\n \"assets\"\n ],\n \"properties\": {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + \ \"properties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ },\n \"assets\": {\n \"type\": \"object\",\n + \ \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n }\n }\n }\n ]\n },\n + \ {\n \"$comment\": \"This is the schema for STAC Collections.\",\n + \ \"type\": \"object\",\n \"allOf\": [\n {\n \"required\": + [\n \"type\"\n ],\n \"properties\": {\n \"type\": + {\n \"const\": \"Collection\"\n }\n }\n },\n + \ {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection.\",\n \"allOf\": [\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n },\n {\n + \ \"$comment\": \"This validates the fields in Collection Assets.\",\n + \ \"properties\": {\n \"assets\": {\n \"type\": + \"object\",\n \"additionalProperties\": {\n \"$ref\": + \"#/definitions/fields\"\n }\n }\n }\n },\n + \ {\n \"$comment\": \"This is the schema for the fields in + Item Asset Definitions.\",\n \"properties\": {\n \"item_assets\": + {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n + is the schema for STAC Catalog.\",\n \"allOf\": [\n {\n \"type\": + \"object\",\n \"required\": [\n \"type\"\n ],\n \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$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.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$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.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + \"Catalog\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n },\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n }\n ],\n \"definitions\": {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \"https://stac-extensions.github.io/version/v1.2.0/schema.json\"\n }\n + \ }\n }\n },\n \"fields\": {\n \"type\": \"object\",\n + \ \"properties\": {\n \"version\": {\n \"type\": \"string\",\n + \ \"title\": \"Version\"\n },\n \"deprecated\": {\n + \ \"type\": \"boolean\",\n \"title\": \"Deprecated\",\n \"default\": + false\n },\n \"experimental\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Experimental\",\n \"default\": false\n }\n \ }\n }\n }\n}\n" headers: Accept-Ranges: @@ -84,19 +65,19 @@ interactions: Access-Control-Allow-Origin: - '*' Age: - - '516' + - '442' Cache-Control: - max-age=600 Connection: - close Content-Length: - - '5009' + - '3405' Content-Type: - application/json; charset=utf-8 Date: - - Wed, 27 Sep 2023 21:20:49 GMT + - Fri, 13 Oct 2023 13:39:12 GMT ETag: - - '"645249bd-1391"' + - '"645249bd-d4d"' Last-Modified: - Wed, 03 May 2023 11:47:09 GMT Server: @@ -112,15 +93,15 @@ interactions: X-Cache-Hits: - '1' X-Fastly-Request-ID: - - 7268ba787ef0f580c134058a458e3a71dfec2e7a + - 6619800fc24a76884b05c4240240e1ce78e9e3bb X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC + - B200:2C1D:709A53:995830:6529359A X-Served-By: - - cache-lga21956-LGA + - cache-iad-kjyo7100024-IAD X-Timer: - - S1695849650.608273,VS0,VE2 + - S1697204352.038017,VS0,VE1 expires: - - Wed, 27 Sep 2023 21:22:13 GMT + - Fri, 13 Oct 2023 12:28:35 GMT permissions-policy: - interest-cohort=() x-proxy-cache: diff --git a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_all_links.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_all_links.yaml index 1dc7361aa..bebcf5d98 100644 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_all_links.yaml +++ b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_all_links.yaml @@ -9,74 +9,55 @@ interactions: User-Agent: - Python-urllib/3.11 method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + uri: https://stac-extensions.github.io/version/v1.2.0/schema.json response: body: string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"https://stac-extensions.github.io/version/v1.2.0/schema.json#\",\n \"title\": \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items.\",\n \"allOf\": [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n \ \"properties\",\n \"assets\"\n ],\n \"properties\": {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + \ \"properties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ },\n \"assets\": {\n \"type\": \"object\",\n + \ \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n }\n }\n }\n ]\n },\n + \ {\n \"$comment\": \"This is the schema for STAC Collections.\",\n + \ \"type\": \"object\",\n \"allOf\": [\n {\n \"required\": + [\n \"type\"\n ],\n \"properties\": {\n \"type\": + {\n \"const\": \"Collection\"\n }\n }\n },\n + \ {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection.\",\n \"allOf\": [\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n },\n {\n + \ \"$comment\": \"This validates the fields in Collection Assets.\",\n + \ \"properties\": {\n \"assets\": {\n \"type\": + \"object\",\n \"additionalProperties\": {\n \"$ref\": + \"#/definitions/fields\"\n }\n }\n }\n },\n + \ {\n \"$comment\": \"This is the schema for the fields in + Item Asset Definitions.\",\n \"properties\": {\n \"item_assets\": + {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n + is the schema for STAC Catalog.\",\n \"allOf\": [\n {\n \"type\": + \"object\",\n \"required\": [\n \"type\"\n ],\n \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$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.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$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.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + \"Catalog\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n },\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n }\n ],\n \"definitions\": {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \"https://stac-extensions.github.io/version/v1.2.0/schema.json\"\n }\n + \ }\n }\n },\n \"fields\": {\n \"type\": \"object\",\n + \ \"properties\": {\n \"version\": {\n \"type\": \"string\",\n + \ \"title\": \"Version\"\n },\n \"deprecated\": {\n + \ \"type\": \"boolean\",\n \"title\": \"Deprecated\",\n \"default\": + false\n },\n \"experimental\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Experimental\",\n \"default\": false\n }\n \ }\n }\n }\n}\n" headers: Accept-Ranges: @@ -84,19 +65,19 @@ interactions: Access-Control-Allow-Origin: - '*' Age: - - '516' + - '442' Cache-Control: - max-age=600 Connection: - close Content-Length: - - '5009' + - '3405' Content-Type: - application/json; charset=utf-8 Date: - - Wed, 27 Sep 2023 21:20:49 GMT + - Fri, 13 Oct 2023 13:39:12 GMT ETag: - - '"645249bd-1391"' + - '"645249bd-d4d"' Last-Modified: - Wed, 03 May 2023 11:47:09 GMT Server: @@ -112,15 +93,15 @@ interactions: X-Cache-Hits: - '1' X-Fastly-Request-ID: - - 23409828487e62ce75feddb9098c346366ddc99d + - 7ffec40c530167e4bcd104e2131d2aa7a782aebb X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC + - B200:2C1D:709A53:995830:6529359A X-Served-By: - - cache-lga21962-LGA + - cache-iad-kjyo7100069-IAD X-Timer: - - S1695849650.736781,VS0,VE2 + - S1697204352.165308,VS0,VE2 expires: - - Wed, 27 Sep 2023 21:22:13 GMT + - Fri, 13 Oct 2023 12:28:35 GMT permissions-policy: - interest-cohort=() x-proxy-cache: diff --git a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_fail_validate.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_fail_validate.yaml deleted file mode 100644 index afb162029..000000000 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_fail_validate.yaml +++ /dev/null @@ -1,131 +0,0 @@ -interactions: -- request: - body: null - headers: - Connection: - - close - Host: - - stac-extensions.github.io - User-Agent: - - Python-urllib/3.11 - method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json - response: - body: - string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": - \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning - Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": - [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n - \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n - \ \"properties\",\n \"assets\"\n ],\n \"properties\": - {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": - {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n - \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n - \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$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.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$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.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": - {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": - [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": - {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n - \ }\n }\n }\n}\n" - headers: - Accept-Ranges: - - bytes - Access-Control-Allow-Origin: - - '*' - Age: - - '516' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:49 GMT - ETag: - - '"645249bd-1391"' - Last-Modified: - - Wed, 03 May 2023 11:47:09 GMT - Server: - - GitHub.com - Strict-Transport-Security: - - max-age=31556952 - Vary: - - Accept-Encoding - Via: - - 1.1 varnish - X-Cache: - - HIT - X-Cache-Hits: - - '1' - X-Fastly-Request-ID: - - 3de786e583bfd289b3b278cbd9d8cf4b3047614c - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21950-LGA - X-Timer: - - S1695849650.880264,VS0,VE2 - expires: - - Wed, 27 Sep 2023 21:22:13 GMT - permissions-policy: - - interest-cohort=() - x-proxy-cache: - - MISS - status: - code: 200 - message: OK -version: 1 diff --git a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_latest.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_latest.yaml index b1df6a2d5..24e198460 100644 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_latest.yaml +++ b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_latest.yaml @@ -9,74 +9,55 @@ interactions: User-Agent: - Python-urllib/3.11 method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + uri: https://stac-extensions.github.io/version/v1.2.0/schema.json response: body: string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"https://stac-extensions.github.io/version/v1.2.0/schema.json#\",\n \"title\": \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items.\",\n \"allOf\": [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n \ \"properties\",\n \"assets\"\n ],\n \"properties\": {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + \ \"properties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ },\n \"assets\": {\n \"type\": \"object\",\n + \ \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n }\n }\n }\n ]\n },\n + \ {\n \"$comment\": \"This is the schema for STAC Collections.\",\n + \ \"type\": \"object\",\n \"allOf\": [\n {\n \"required\": + [\n \"type\"\n ],\n \"properties\": {\n \"type\": + {\n \"const\": \"Collection\"\n }\n }\n },\n + \ {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection.\",\n \"allOf\": [\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n },\n {\n + \ \"$comment\": \"This validates the fields in Collection Assets.\",\n + \ \"properties\": {\n \"assets\": {\n \"type\": + \"object\",\n \"additionalProperties\": {\n \"$ref\": + \"#/definitions/fields\"\n }\n }\n }\n },\n + \ {\n \"$comment\": \"This is the schema for the fields in + Item Asset Definitions.\",\n \"properties\": {\n \"item_assets\": + {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n + is the schema for STAC Catalog.\",\n \"allOf\": [\n {\n \"type\": + \"object\",\n \"required\": [\n \"type\"\n ],\n \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$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.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$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.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + \"Catalog\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n },\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n }\n ],\n \"definitions\": {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \"https://stac-extensions.github.io/version/v1.2.0/schema.json\"\n }\n + \ }\n }\n },\n \"fields\": {\n \"type\": \"object\",\n + \ \"properties\": {\n \"version\": {\n \"type\": \"string\",\n + \ \"title\": \"Version\"\n },\n \"deprecated\": {\n + \ \"type\": \"boolean\",\n \"title\": \"Deprecated\",\n \"default\": + false\n },\n \"experimental\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Experimental\",\n \"default\": false\n }\n \ }\n }\n }\n}\n" headers: Accept-Ranges: @@ -84,19 +65,19 @@ interactions: Access-Control-Allow-Origin: - '*' Age: - - '516' + - '442' Cache-Control: - max-age=600 Connection: - close Content-Length: - - '5009' + - '3405' Content-Type: - application/json; charset=utf-8 Date: - - Wed, 27 Sep 2023 21:20:50 GMT + - Fri, 13 Oct 2023 13:39:12 GMT ETag: - - '"645249bd-1391"' + - '"645249bd-d4d"' Last-Modified: - Wed, 03 May 2023 11:47:09 GMT Server: @@ -112,15 +93,15 @@ interactions: X-Cache-Hits: - '1' X-Fastly-Request-ID: - - 8803f491844c96a22564e51ecd5cdf1fbd6214b5 + - 4160a56f18a69b78cf330f6ffd60ede27d886c86 X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC + - B200:2C1D:709A53:995830:6529359A X-Served-By: - - cache-lga21947-LGA + - cache-iad-kjyo7100173-IAD X-Timer: - - S1695849650.041793,VS0,VE2 + - S1697204352.357021,VS0,VE1 expires: - - Wed, 27 Sep 2023 21:22:13 GMT + - Fri, 13 Oct 2023 12:28:35 GMT permissions-policy: - interest-cohort=() x-proxy-cache: diff --git a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_predecessor.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_predecessor.yaml index 3c1e3951a..97eff2fe4 100644 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_predecessor.yaml +++ b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_predecessor.yaml @@ -9,74 +9,55 @@ interactions: User-Agent: - Python-urllib/3.11 method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + uri: https://stac-extensions.github.io/version/v1.2.0/schema.json response: body: string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"https://stac-extensions.github.io/version/v1.2.0/schema.json#\",\n \"title\": \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items.\",\n \"allOf\": [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n \ \"properties\",\n \"assets\"\n ],\n \"properties\": {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + \ \"properties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ },\n \"assets\": {\n \"type\": \"object\",\n + \ \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n }\n }\n }\n ]\n },\n + \ {\n \"$comment\": \"This is the schema for STAC Collections.\",\n + \ \"type\": \"object\",\n \"allOf\": [\n {\n \"required\": + [\n \"type\"\n ],\n \"properties\": {\n \"type\": + {\n \"const\": \"Collection\"\n }\n }\n },\n + \ {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection.\",\n \"allOf\": [\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n },\n {\n + \ \"$comment\": \"This validates the fields in Collection Assets.\",\n + \ \"properties\": {\n \"assets\": {\n \"type\": + \"object\",\n \"additionalProperties\": {\n \"$ref\": + \"#/definitions/fields\"\n }\n }\n }\n },\n + \ {\n \"$comment\": \"This is the schema for the fields in + Item Asset Definitions.\",\n \"properties\": {\n \"item_assets\": + {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n + is the schema for STAC Catalog.\",\n \"allOf\": [\n {\n \"type\": + \"object\",\n \"required\": [\n \"type\"\n ],\n \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$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.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$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.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + \"Catalog\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n },\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n }\n ],\n \"definitions\": {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \"https://stac-extensions.github.io/version/v1.2.0/schema.json\"\n }\n + \ }\n }\n },\n \"fields\": {\n \"type\": \"object\",\n + \ \"properties\": {\n \"version\": {\n \"type\": \"string\",\n + \ \"title\": \"Version\"\n },\n \"deprecated\": {\n + \ \"type\": \"boolean\",\n \"title\": \"Deprecated\",\n \"default\": + false\n },\n \"experimental\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Experimental\",\n \"default\": false\n }\n \ }\n }\n }\n}\n" headers: Accept-Ranges: @@ -84,19 +65,19 @@ interactions: Access-Control-Allow-Origin: - '*' Age: - - '517' + - '442' Cache-Control: - max-age=600 Connection: - close Content-Length: - - '5009' + - '3405' Content-Type: - application/json; charset=utf-8 Date: - - Wed, 27 Sep 2023 21:20:50 GMT + - Fri, 13 Oct 2023 13:39:12 GMT ETag: - - '"645249bd-1391"' + - '"645249bd-d4d"' Last-Modified: - Wed, 03 May 2023 11:47:09 GMT Server: @@ -110,17 +91,17 @@ interactions: X-Cache: - HIT X-Cache-Hits: - - '1' + - '3' X-Fastly-Request-ID: - - 351e5d16b1673cf1be6b345ca7c427f93662b47f + - 0892056a23c5c7666ddaa424eb4b233de70c5ba3 X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC + - B200:2C1D:709A53:995830:6529359A X-Served-By: - - cache-lga21928-LGA + - cache-iad-kjyo7100139-IAD X-Timer: - - S1695849650.203105,VS0,VE2 + - S1697204353.506589,VS0,VE0 expires: - - Wed, 27 Sep 2023 21:22:13 GMT + - Fri, 13 Oct 2023 12:28:35 GMT permissions-policy: - interest-cohort=() x-proxy-cache: diff --git a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_successor.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_successor.yaml index c218ee89c..206b5f8b2 100644 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_successor.yaml +++ b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_successor.yaml @@ -9,74 +9,55 @@ interactions: User-Agent: - Python-urllib/3.11 method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + uri: https://stac-extensions.github.io/version/v1.2.0/schema.json response: body: string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"https://stac-extensions.github.io/version/v1.2.0/schema.json#\",\n \"title\": \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items.\",\n \"allOf\": [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n \ \"properties\",\n \"assets\"\n ],\n \"properties\": {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + \ \"properties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ },\n \"assets\": {\n \"type\": \"object\",\n + \ \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n }\n }\n }\n ]\n },\n + \ {\n \"$comment\": \"This is the schema for STAC Collections.\",\n + \ \"type\": \"object\",\n \"allOf\": [\n {\n \"required\": + [\n \"type\"\n ],\n \"properties\": {\n \"type\": + {\n \"const\": \"Collection\"\n }\n }\n },\n + \ {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection.\",\n \"allOf\": [\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n },\n {\n + \ \"$comment\": \"This validates the fields in Collection Assets.\",\n + \ \"properties\": {\n \"assets\": {\n \"type\": + \"object\",\n \"additionalProperties\": {\n \"$ref\": + \"#/definitions/fields\"\n }\n }\n }\n },\n + \ {\n \"$comment\": \"This is the schema for the fields in + Item Asset Definitions.\",\n \"properties\": {\n \"item_assets\": + {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n + is the schema for STAC Catalog.\",\n \"allOf\": [\n {\n \"type\": + \"object\",\n \"required\": [\n \"type\"\n ],\n \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$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.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$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.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + \"Catalog\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n },\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n }\n ],\n \"definitions\": {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \"https://stac-extensions.github.io/version/v1.2.0/schema.json\"\n }\n + \ }\n }\n },\n \"fields\": {\n \"type\": \"object\",\n + \ \"properties\": {\n \"version\": {\n \"type\": \"string\",\n + \ \"title\": \"Version\"\n },\n \"deprecated\": {\n + \ \"type\": \"boolean\",\n \"title\": \"Deprecated\",\n \"default\": + false\n },\n \"experimental\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Experimental\",\n \"default\": false\n }\n \ }\n }\n }\n}\n" headers: Accept-Ranges: @@ -84,19 +65,19 @@ interactions: Access-Control-Allow-Origin: - '*' Age: - - '517' + - '443' Cache-Control: - max-age=600 Connection: - close Content-Length: - - '5009' + - '3405' Content-Type: - application/json; charset=utf-8 Date: - - Wed, 27 Sep 2023 21:20:50 GMT + - Fri, 13 Oct 2023 13:39:12 GMT ETag: - - '"645249bd-1391"' + - '"645249bd-d4d"' Last-Modified: - Wed, 03 May 2023 11:47:09 GMT Server: @@ -112,15 +93,15 @@ interactions: X-Cache-Hits: - '1' X-Fastly-Request-ID: - - b4f39da9a3d422da91576b6743202220c8c70f13 + - 20038aa567c62333e2d21b7396809dbd5fb3a7a0 X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC + - B200:2C1D:709A53:995830:6529359A X-Served-By: - - cache-lga21965-LGA + - cache-iad-kjyo7100148-IAD X-Timer: - - S1695849650.349754,VS0,VE2 + - S1697204353.637609,VS0,VE1 expires: - - Wed, 27 Sep 2023 21:22:13 GMT + - Fri, 13 Oct 2023 12:28:35 GMT permissions-policy: - interest-cohort=() x-proxy-cache: diff --git a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_validate_without_anything.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_validate_without_anything.yaml new file mode 100644 index 000000000..2e2cf7063 --- /dev/null +++ b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_validate_without_anything.yaml @@ -0,0 +1,112 @@ +interactions: +- request: + body: null + headers: + Connection: + - close + Host: + - stac-extensions.github.io + User-Agent: + - Python-urllib/3.11 + method: GET + uri: https://stac-extensions.github.io/version/v1.2.0/schema.json + response: + body: + string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": + \"https://stac-extensions.github.io/version/v1.2.0/schema.json#\",\n \"title\": + \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning + Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items.\",\n \"allOf\": + [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n + \ \"properties\",\n \"assets\"\n ],\n \"properties\": + {\n \"type\": {\n \"const\": \"Feature\"\n },\n + \ \"properties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ },\n \"assets\": {\n \"type\": \"object\",\n + \ \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n }\n }\n }\n ]\n },\n + \ {\n \"$comment\": \"This is the schema for STAC Collections.\",\n + \ \"type\": \"object\",\n \"allOf\": [\n {\n \"required\": + [\n \"type\"\n ],\n \"properties\": {\n \"type\": + {\n \"const\": \"Collection\"\n }\n }\n },\n + \ {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection.\",\n \"allOf\": [\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n },\n {\n + \ \"$comment\": \"This validates the fields in Collection Assets.\",\n + \ \"properties\": {\n \"assets\": {\n \"type\": + \"object\",\n \"additionalProperties\": {\n \"$ref\": + \"#/definitions/fields\"\n }\n }\n }\n },\n + \ {\n \"$comment\": \"This is the schema for the fields in + Item Asset Definitions.\",\n \"properties\": {\n \"item_assets\": + {\n \"type\": \"object\",\n \"additionalProperties\": + {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n + \ }\n }\n ]\n },\n {\n \"$comment\": \"This + is the schema for STAC Catalog.\",\n \"allOf\": [\n {\n \"type\": + \"object\",\n \"required\": [\n \"type\"\n ],\n + \ \"properties\": {\n \"type\": {\n \"const\": + \"Catalog\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n },\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n }\n ],\n \"definitions\": + {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": + [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": + {\n \"type\": \"array\",\n \"contains\": {\n \"const\": + \"https://stac-extensions.github.io/version/v1.2.0/schema.json\"\n }\n + \ }\n }\n },\n \"fields\": {\n \"type\": \"object\",\n + \ \"properties\": {\n \"version\": {\n \"type\": \"string\",\n + \ \"title\": \"Version\"\n },\n \"deprecated\": {\n + \ \"type\": \"boolean\",\n \"title\": \"Deprecated\",\n \"default\": + false\n },\n \"experimental\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Experimental\",\n \"default\": false\n }\n + \ }\n }\n }\n}\n" + headers: + Accept-Ranges: + - bytes + Access-Control-Allow-Origin: + - '*' + Age: + - '443' + Cache-Control: + - max-age=600 + Connection: + - close + Content-Length: + - '3405' + Content-Type: + - application/json; charset=utf-8 + Date: + - Fri, 13 Oct 2023 13:39:12 GMT + ETag: + - '"645249bd-d4d"' + Last-Modified: + - Wed, 03 May 2023 11:47:09 GMT + Server: + - GitHub.com + Strict-Transport-Security: + - max-age=31556952 + Vary: + - Accept-Encoding + Via: + - 1.1 varnish + X-Cache: + - HIT + X-Cache-Hits: + - '1' + X-Fastly-Request-ID: + - 450ccdc9ddde81cae4ccdd820dd44a375f177813 + X-GitHub-Request-Id: + - B200:2C1D:709A53:995830:6529359A + X-Served-By: + - cache-iad-kjyo7100128-IAD + X-Timer: + - S1697204353.764442,VS0,VE1 + expires: + - Fri, 13 Oct 2023 12:28:35 GMT + permissions-policy: + - interest-cohort=() + x-proxy-cache: + - MISS + status: + code: 200 + message: OK +version: 1 diff --git a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_version_in_properties.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_version_in_properties.yaml index 3c835c4b3..23b104e7c 100644 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_version_in_properties.yaml +++ b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_version_in_properties.yaml @@ -9,74 +9,55 @@ interactions: User-Agent: - Python-urllib/3.11 method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + uri: https://stac-extensions.github.io/version/v1.2.0/schema.json response: body: string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"https://stac-extensions.github.io/version/v1.2.0/schema.json#\",\n \"title\": \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items.\",\n \"allOf\": [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n \ \"properties\",\n \"assets\"\n ],\n \"properties\": {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + \ \"properties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ },\n \"assets\": {\n \"type\": \"object\",\n + \ \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n }\n }\n }\n ]\n },\n + \ {\n \"$comment\": \"This is the schema for STAC Collections.\",\n + \ \"type\": \"object\",\n \"allOf\": [\n {\n \"required\": + [\n \"type\"\n ],\n \"properties\": {\n \"type\": + {\n \"const\": \"Collection\"\n }\n }\n },\n + \ {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection.\",\n \"allOf\": [\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n },\n {\n + \ \"$comment\": \"This validates the fields in Collection Assets.\",\n + \ \"properties\": {\n \"assets\": {\n \"type\": + \"object\",\n \"additionalProperties\": {\n \"$ref\": + \"#/definitions/fields\"\n }\n }\n }\n },\n + \ {\n \"$comment\": \"This is the schema for the fields in + Item Asset Definitions.\",\n \"properties\": {\n \"item_assets\": + {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n + is the schema for STAC Catalog.\",\n \"allOf\": [\n {\n \"type\": + \"object\",\n \"required\": [\n \"type\"\n ],\n \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$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.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$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.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + \"Catalog\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n },\n {\n \"$ref\": + \"#/definitions/fields\"\n }\n ]\n }\n ],\n \"definitions\": {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \"https://stac-extensions.github.io/version/v1.2.0/schema.json\"\n }\n + \ }\n }\n },\n \"fields\": {\n \"type\": \"object\",\n + \ \"properties\": {\n \"version\": {\n \"type\": \"string\",\n + \ \"title\": \"Version\"\n },\n \"deprecated\": {\n + \ \"type\": \"boolean\",\n \"title\": \"Deprecated\",\n \"default\": + false\n },\n \"experimental\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Experimental\",\n \"default\": false\n }\n \ }\n }\n }\n}\n" headers: Accept-Ranges: @@ -84,19 +65,19 @@ interactions: Access-Control-Allow-Origin: - '*' Age: - - '517' + - '443' Cache-Control: - max-age=600 Connection: - close Content-Length: - - '5009' + - '3405' Content-Type: - application/json; charset=utf-8 Date: - - Wed, 27 Sep 2023 21:20:50 GMT + - Fri, 13 Oct 2023 13:39:12 GMT ETag: - - '"645249bd-1391"' + - '"645249bd-d4d"' Last-Modified: - Wed, 03 May 2023 11:47:09 GMT Server: @@ -112,15 +93,15 @@ interactions: X-Cache-Hits: - '1' X-Fastly-Request-ID: - - c8757216a09cff172aa5f3dd6f582888f9420c7a + - cb216caa979da1f1598f496702440c26a7ddd3a5 X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC + - B200:2C1D:709A53:995830:6529359A X-Served-By: - - cache-lga21953-LGA + - cache-iad-kjyo7100119-IAD X-Timer: - - S1695849650.494674,VS0,VE1 + - S1697204353.886432,VS0,VE1 expires: - - Wed, 27 Sep 2023 21:22:13 GMT + - Fri, 13 Oct 2023 12:28:35 GMT permissions-policy: - interest-cohort=() x-proxy-cache: diff --git a/tests/extensions/test_version.py b/tests/extensions/test_version.py index 1d5641878..6bfc9399b 100644 --- a/tests/extensions/test_version.py +++ b/tests/extensions/test_version.py @@ -8,6 +8,7 @@ import pytest import pystac +from pystac import Asset, Catalog, Item from pystac.errors import DeprecatedWarning, ExtensionTypeError from pystac.extensions import version from pystac.extensions.version import ( @@ -22,14 +23,12 @@ URL_TEMPLATE: str = "http://example.com/catalog/%s.json" -def make_item(year: int) -> pystac.Item: +def make_item(year: int) -> Item: """Create basic test items that are only slightly different.""" asset_id = f"USGS/GAP/CONUS/{year}" start = datetime(year, 1, 2) - item = pystac.Item( - id=asset_id, geometry=None, bbox=None, datetime=start, properties={} - ) + item = Item(id=asset_id, geometry=None, bbox=None, datetime=start, properties={}) item.set_self_href(URL_TEMPLATE % year) VersionExtension.add_to(item) @@ -134,9 +133,9 @@ def test_successor(self) -> None: self.item.validate() @pytest.mark.vcr() - def test_fail_validate(self) -> None: - with self.assertRaises(pystac.STACValidationError): - self.item.validate() + def test_validate_without_anything(self) -> None: + # As of v1.1.0, there are no required fields + self.item.validate() @pytest.mark.vcr() def test_all_links(self) -> None: @@ -247,14 +246,14 @@ def test_multiple_link_setting(self) -> None: def test_extension_not_implemented(self) -> None: # Should raise exception if Item does not include extension URI - item = pystac.Item.from_file(self.example_item_uri) + item = Item.from_file(self.example_item_uri) item.stac_extensions.remove(VersionExtension.get_schema_uri()) with self.assertRaises(pystac.ExtensionNotImplemented): _ = VersionExtension.ext(item) def test_ext_add_to(self) -> None: - item = pystac.Item.from_file(self.example_item_uri) + item = Item.from_file(self.example_item_uri) item.stac_extensions.remove(VersionExtension.get_schema_uri()) self.assertNotIn(VersionExtension.get_schema_uri(), item.stac_extensions) @@ -366,8 +365,7 @@ def test_successor(self) -> None: @pytest.mark.vcr() def test_fail_validate(self) -> None: - with self.assertRaises(pystac.STACValidationError): - self.collection.validate() + self.collection.validate() @pytest.mark.vcr() def test_validate_all(self) -> None: @@ -500,27 +498,27 @@ def test_ext_add_to(self) -> None: def test_item_deprecation_warning( - item: pystac.Item, recwarn: Generator[pytest.WarningsRecorder, None, None] + item: Item, recwarn: Generator[pytest.WarningsRecorder, None, None] ) -> None: version = ItemVersionExtension.ext(item, add_if_missing=True) version.deprecated = True item_dict = item.to_dict() with pytest.warns(DeprecatedWarning, match="The item 'test-item' is deprecated."): - _ = pystac.Item.from_dict(item_dict) + _ = Item.from_dict(item_dict) version.deprecated = False item_dict = item.to_dict() - _ = pystac.Item.from_dict(item_dict) + _ = Item.from_dict(item_dict) assert len(list(recwarn)) == 0 version.deprecated = None item_dict = item.to_dict() - _ = pystac.Item.from_dict(item_dict) + _ = Item.from_dict(item_dict) assert len(list(recwarn)) == 0 ItemVersionExtension.remove_from(item) item_dict = item.to_dict() - _ = pystac.Item.from_dict(item_dict) + _ = Item.from_dict(item_dict) assert len(list(recwarn)) == 0 @@ -554,7 +552,7 @@ def test_collection_deprecation_warning( def test_ignore_deprecated_context_manager( - item: pystac.Item, recwarn: Generator[pytest.WarningsRecorder, None, None] + item: Item, recwarn: Generator[pytest.WarningsRecorder, None, None] ) -> None: version = VersionExtension.ext(item, add_if_missing=True) version.deprecated = True @@ -562,3 +560,45 @@ def test_ignore_deprecated_context_manager( with ignore_deprecated(): _ = pystac.Item.from_dict(item_dict) assert len(list(recwarn)) == 0 + + +def test_experimental(item: Item) -> None: + # experimental was added in v1.2.0 + assert not item.ext.has("version") + item.ext.add("version") + assert not item.ext.version.experimental + item.ext.version.experimental = True + assert item.ext.version.experimental + + +def test_version_not_required(item: Item) -> None: + # version was relaxed to optional in v1.1.0 + assert not item.ext.has("version") + item.ext.add("version") + assert item.ext.version.version is None + item.ext.version.version = "final_final_2" + assert item.ext.version.version == "final_final_2" + item.ext.version.version = None + item_dict = item.to_dict() + assert "version" not in item_dict["properties"] + + +def test_asset(item: Item) -> None: + # Assets were explicitly supported in v1.1.0 + asset = Asset("asset.tif") + item.add_asset("the-asset", asset) + assert not asset.ext.has("version") + asset.ext.add("version") + asset.ext.version.version = "final_final_2" + assert item.ext.has("version") + item.validate() + with pytest.raises(AttributeError): + asset.ext.version.latest + + +def test_catalog(catalog: Catalog) -> None: + # Catalog were allowed in v1.1.0 + assert not catalog.ext.has("version") + catalog.ext.add("version") + catalog.ext.version.version = "final_final_2" + catalog.validate()