diff --git a/CHANGELOG.md b/CHANGELOG.md index 755523066..04a65fb8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - `validate_all` now accepts a `STACObject` (in addition to accepting a dict, which is now deprecated), but prohibits supplying a value for `href`, which must be supplied _only_ when supplying an object as a dict. Once `validate_all` removes support for an object as a dict, the `href` parameter will also be removed. ([#1246](https://github.com/stac-utils/pystac/pull/1246)) - Report `href` when schema url resolution fails ([#1263](https://github.com/stac-utils/pystac/pull/1263)) +- Version extension updated to v1.2.0 ([#1262](https://github.com/stac-utils/pystac/pull/1262)) ### Fixed diff --git a/pystac/catalog.py b/pystac/catalog.py index 680a31b6a..7f9468baf 100644 --- a/pystac/catalog.py +++ b/pystac/catalog.py @@ -40,6 +40,7 @@ if TYPE_CHECKING: from pystac.asset import Asset from pystac.collection import Collection + from pystac.extensions.ext import CatalogExt from pystac.item import Item C = TypeVar("C", bound="Catalog") @@ -1245,3 +1246,15 @@ def from_file(cls: type[C], href: HREF, stac_io: pystac.StacIO | None = None) -> @classmethod def matches_object_type(cls, d: dict[str, Any]) -> bool: return identify_stac_object_type(d) == STACObjectType.CATALOG + + @property + def ext(self) -> CatalogExt: + """Accessor for extension classes on this catalog + + Example:: + + print(collection.ext.version) + """ + from pystac.extensions.ext import CatalogExt + + return CatalogExt(stac_object=self) diff --git a/pystac/extensions/ext.py b/pystac/extensions/ext.py index c7a213287..1e99b96a7 100644 --- a/pystac/extensions/ext.py +++ b/pystac/extensions/ext.py @@ -1,7 +1,7 @@ from dataclasses import dataclass from typing import Any, Generic, Literal, TypeVar, cast -import pystac +from pystac import Asset, Catalog, Collection, Item, STACError from pystac.extensions.classification import ClassificationExtension from pystac.extensions.datacube import DatacubeExtension from pystac.extensions.eo import EOExtension @@ -18,11 +18,11 @@ from pystac.extensions.storage import StorageExtension from pystac.extensions.table import TableExtension from pystac.extensions.timestamps import TimestampsExtension -from pystac.extensions.version import VersionExtension +from pystac.extensions.version import BaseVersionExtension, VersionExtension from pystac.extensions.view import ViewExtension from pystac.extensions.xarray_assets import XarrayAssetsExtension -T = TypeVar("T", pystac.Asset, AssetDefinition) +T = TypeVar("T", Asset, AssetDefinition) EXTENSION_NAMES = Literal[ "classification", @@ -80,8 +80,8 @@ def _get_class_by_name(name: str) -> Any: @dataclass -class CollectionExt: - stac_object: pystac.Collection +class CatalogExt: + stac_object: Catalog def has(self, name: EXTENSION_NAMES) -> bool: return cast(bool, _get_class_by_name(name).has_extension(self.stac_object)) @@ -93,7 +93,16 @@ def remove(self, name: EXTENSION_NAMES) -> None: _get_class_by_name(name).remove_from(self.stac_object) @property - def cube(self) -> DatacubeExtension[pystac.Collection]: + def version(self) -> VersionExtension[Catalog]: + return VersionExtension.ext(self.stac_object) + + +@dataclass +class CollectionExt(CatalogExt): + stac_object: Collection + + @property + def cube(self) -> DatacubeExtension[Collection]: return DatacubeExtension.ext(self.stac_object) @property @@ -101,25 +110,21 @@ def item_assets(self) -> dict[str, AssetDefinition]: return ItemAssetsExtension.ext(self.stac_object).item_assets @property - def sci(self) -> ScientificExtension[pystac.Collection]: + def sci(self) -> ScientificExtension[Collection]: return ScientificExtension.ext(self.stac_object) @property - def table(self) -> TableExtension[pystac.Collection]: + def table(self) -> TableExtension[Collection]: return TableExtension.ext(self.stac_object) @property - def version(self) -> VersionExtension[pystac.Collection]: - return VersionExtension.ext(self.stac_object) - - @property - def xarray(self) -> XarrayAssetsExtension[pystac.Collection]: + def xarray(self) -> XarrayAssetsExtension[Collection]: return XarrayAssetsExtension.ext(self.stac_object) @dataclass class ItemExt: - stac_object: pystac.Item + stac_object: Item def has(self, name: EXTENSION_NAMES) -> bool: return cast(bool, _get_class_by_name(name).has_extension(self.stac_object)) @@ -131,15 +136,15 @@ def remove(self, name: EXTENSION_NAMES) -> None: _get_class_by_name(name).remove_from(self.stac_object) @property - def classification(self) -> ClassificationExtension[pystac.Item]: + def classification(self) -> ClassificationExtension[Item]: return ClassificationExtension.ext(self.stac_object) @property - def cube(self) -> DatacubeExtension[pystac.Item]: + def cube(self) -> DatacubeExtension[Item]: return DatacubeExtension.ext(self.stac_object) @property - def eo(self) -> EOExtension[pystac.Item]: + def eo(self) -> EOExtension[Item]: return EOExtension.ext(self.stac_object) @property @@ -151,43 +156,43 @@ def mgrs(self) -> MgrsExtension: return MgrsExtension.ext(self.stac_object) @property - def pc(self) -> PointcloudExtension[pystac.Item]: + def pc(self) -> PointcloudExtension[Item]: return PointcloudExtension.ext(self.stac_object) @property - def proj(self) -> ProjectionExtension[pystac.Item]: + def proj(self) -> ProjectionExtension[Item]: return ProjectionExtension.ext(self.stac_object) @property - def sar(self) -> SarExtension[pystac.Item]: + def sar(self) -> SarExtension[Item]: return SarExtension.ext(self.stac_object) @property - def sat(self) -> SatExtension[pystac.Item]: + def sat(self) -> SatExtension[Item]: return SatExtension.ext(self.stac_object) @property - def storage(self) -> StorageExtension[pystac.Item]: + def storage(self) -> StorageExtension[Item]: return StorageExtension.ext(self.stac_object) @property - def table(self) -> TableExtension[pystac.Item]: + def table(self) -> TableExtension[Item]: return TableExtension.ext(self.stac_object) @property - def timestamps(self) -> TimestampsExtension[pystac.Item]: + def timestamps(self) -> TimestampsExtension[Item]: return TimestampsExtension.ext(self.stac_object) @property - def version(self) -> VersionExtension[pystac.Item]: + def version(self) -> VersionExtension[Item]: return VersionExtension.ext(self.stac_object) @property - def view(self) -> ViewExtension[pystac.Item]: + def view(self) -> ViewExtension[Item]: return ViewExtension.ext(self.stac_object) @property - def xarray(self) -> XarrayAssetsExtension[pystac.Item]: + def xarray(self) -> XarrayAssetsExtension[Item]: return XarrayAssetsExtension.ext(self.stac_object) @@ -196,7 +201,7 @@ class _AssetExt(Generic[T]): def has(self, name: EXTENSION_NAMES) -> bool: if self.stac_object.owner is None: - raise pystac.STACError( + raise STACError( f"Attempted to add extension='{name}' for an Asset with no owner. " "Use Asset.set_owner and then try to add the extension again." ) @@ -207,7 +212,7 @@ def has(self, name: EXTENSION_NAMES) -> bool: def add(self, name: EXTENSION_NAMES) -> None: if self.stac_object.owner is None: - raise pystac.STACError( + raise STACError( f"Attempted to add extension='{name}' for an Asset with no owner. " "Use Asset.set_owner and then try to add the extension again." ) @@ -216,7 +221,7 @@ def add(self, name: EXTENSION_NAMES) -> None: def remove(self, name: EXTENSION_NAMES) -> None: if self.stac_object.owner is None: - raise pystac.STACError( + raise STACError( f"Attempted to remove extension='{name}' for an Asset with no owner. " "Use Asset.set_owner and then try to remove the extension again." ) @@ -263,25 +268,29 @@ def storage(self) -> StorageExtension[T]: def table(self) -> TableExtension[T]: return TableExtension.ext(self.stac_object) + @property + def version(self) -> BaseVersionExtension[T]: + return BaseVersionExtension.ext(self.stac_object) + @property def view(self) -> ViewExtension[T]: return ViewExtension.ext(self.stac_object) @dataclass -class AssetExt(_AssetExt[pystac.Asset]): - stac_object: pystac.Asset +class AssetExt(_AssetExt[Asset]): + stac_object: Asset @property def file(self) -> FileExtension: return FileExtension.ext(self.stac_object) @property - def timestamps(self) -> TimestampsExtension[pystac.Asset]: + def timestamps(self) -> TimestampsExtension[Asset]: return TimestampsExtension.ext(self.stac_object) @property - def xarray(self) -> XarrayAssetsExtension[pystac.Asset]: + def xarray(self) -> XarrayAssetsExtension[Asset]: return XarrayAssetsExtension.ext(self.stac_object) diff --git a/pystac/extensions/version.py b/pystac/extensions/version.py index 56490d072..56482bc35 100644 --- a/pystac/extensions/version.py +++ b/pystac/extensions/version.py @@ -13,20 +13,33 @@ cast, ) -import pystac +from pystac import ( + Asset, + Catalog, + Collection, + ExtensionTypeError, + Item, + Link, + MediaType, + STACObject, + STACObjectType, +) 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.extensions.item_assets import AssetDefinition +from pystac.utils import StringEnum, map_opt -T = TypeVar("T", pystac.Collection, pystac.Item) +T = TypeVar("T", Collection, Item, Catalog, Asset, AssetDefinition) +U = TypeVar("U", Collection, Item, Catalog) -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:" VERSION: str = "version" DEPRECATED: str = "deprecated" +EXPERIMENTAL: str = "experimental" class VersionRelType(StringEnum): @@ -47,17 +60,122 @@ class VersionRelType(StringEnum): """Indicates a link pointing to a resource containing the successor version in the version history.""" + HISTORY = "version-history" + """This link points to a version history or changelog. + + This can be for example a Markdown file with the corresponding media type or + a STAC Catalog or Collection. + """ + -class VersionExtension( +class BaseVersionExtension( Generic[T], PropertiesExtension, - ExtensionManagementMixin[Union[pystac.Collection, pystac.Item]], + ExtensionManagementMixin[Union[Collection, Item, Catalog]], +): + """A base extension that just gets and sets attributes, not links. + + Used for Assets and AssetDefinitions. + """ + + name: Literal["version"] = "version" + + def apply_base( + self, + version: str | None = None, + deprecated: bool | None = None, + experimental: bool | None = None, + ) -> None: + """Applies attributes to this extension object.""" + self.version = version + self.deprecated = deprecated + self.experimental = experimental + + @property + def version(self) -> str | None: + """Get or sets a version string of this object.""" + return self._get_property(VERSION, str) + + @version.setter + def version(self, v: str) -> None: + self._set_property(VERSION, v, pop_if_none=True) + + @property + def deprecated(self) -> bool | None: + """Get or sets whether this object is deprecated. + + A value of ``True`` specifies that the object is deprecated with the + potential to be removed. It should be transitioned out of usage as soon + as possible and users should refrain from using it in new projects. A + link with relation type ``latest-version`` SHOULD be added to the links + and MUST refer to the resource that can be used instead. + + NOTE: + A :class:`pystac.DeprecatedWarning` is issued if the ``deprecated`` + property is ``True`` when deserializing a dictionary to an object. + The :meth:`~pystac.extensions.version.ignore_deprecated` context + manager is provided as a convenience to suppress these warnings: + + >>> with ignore_deprecated(): + ... deprecated_item = pystac.Item.from_dict(deprecated_item_dict) + """ + return self._get_property(DEPRECATED, bool) + + @deprecated.setter + def deprecated(self, v: bool | None) -> None: + self._set_property(DEPRECATED, v, pop_if_none=True) + + @property + def experimental(self) -> bool | None: + """Get and set whether this object is experimental. + + Specifies that the context this field is used in (e.g. Asset or + Collection) is experimental with the potential to break or be unstable. + """ + return self._get_property(EXPERIMENTAL, bool) + + @experimental.setter + def experimental(self, v: bool | None) -> None: + self._set_property(EXPERIMENTAL, v, pop_if_none=True) + + @classmethod + def get_schema_uri(cls) -> str: + return SCHEMA_URI + + @classmethod + def ext(cls, obj: T, add_if_missing: bool = False) -> BaseVersionExtension[T]: + """Extends the given STAC Object with properties from the :stac-ext:`Versioning + Indicators Extension `. + + Raises: + + pystac.ExtensionTypeError : If an invalid object type is passed. + """ + if isinstance(obj, Collection): + cls.ensure_has_extension(obj, add_if_missing) + return cast(BaseVersionExtension[T], CollectionVersionExtension(obj)) + elif isinstance(obj, Catalog): + cls.ensure_has_extension(obj, add_if_missing) + return cast(BaseVersionExtension[T], CatalogVersionExtension(obj)) + elif isinstance(obj, Item): + cls.ensure_has_extension(obj, add_if_missing) + return cast(BaseVersionExtension[T], ItemVersionExtension(obj)) + elif isinstance(obj, Asset): + cls.ensure_owner_has_extension(obj, add_if_missing) + return cast(BaseVersionExtension[T], AssetVersionExtension(obj)) + else: + raise ExtensionTypeError(cls._ext_error_message(obj)) + + +class VersionExtension( + Generic[U], + BaseVersionExtension[U], ): """An abstract class that can be used to extend the properties of an - :class:`~pystac.Item` or :class:`~pystac.Collection` with properties from the - :stac-ext:`Versioning Indicators Extension `. This class is generic over - the type of STAC Object to be extended (e.g. :class:`~pystac.Item`, - :class:`~pystac.Collection`). + :class:`~pystac.Item`, :class:`~pystac.Collection`, or + :class:`~pystac.Catalog` with properties from the :stac-ext:`Versioning + Indicators Extension `. This class is generic over the type of STAC + Object to be extended. To create a concrete instance of :class:`VersionExtension`, use the :meth:`VersionExtension.ext` method. For example: @@ -68,19 +186,19 @@ class VersionExtension( >>> version_ext = VersionExtension.ext(item) """ - name: Literal["version"] = "version" - obj: pystac.STACObject + obj: STACObject - def __init__(self, obj: pystac.STACObject) -> None: + def __init__(self, obj: STACObject) -> None: self.obj = obj def apply( self, - version: str, + version: str | None = None, deprecated: bool | None = None, - latest: T | None = None, - predecessor: T | None = None, - successor: T | None = None, + experimental: bool | None = None, + latest: U | None = None, + predecessor: U | None = None, + successor: U | None = None, ) -> None: """Applies version extension properties to the extended :class:`~pystac.Item` or :class:`~pystac.Collection`. @@ -95,9 +213,7 @@ def apply( successor : Item representing the resource containing the successor version in the version history. """ - self.version = version - if deprecated is not None: - self.deprecated = deprecated + self.apply_base(version, deprecated, experimental) if latest: self.latest = latest if predecessor: @@ -106,111 +222,63 @@ def apply( self.successor = successor @property - def version(self) -> str: - """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) - - @version.setter - def version(self, v: str) -> None: - self._set_property(VERSION, v, pop_if_none=False) - - @property - def deprecated(self) -> bool | None: - """Get or sets whether the item is deprecated. - - A value of ``True`` specifies that the Collection or Item is deprecated with the - potential to be removed. It should be transitioned out of usage as soon as - possible and users should refrain from using it in new projects. A link with - relation type ``latest-version`` SHOULD be added to the links and MUST refer to - the resource that can be used instead. - - NOTE: - A :class:`pystac.DeprecatedWarning` is issued if the ``deprecated`` - property is ``True`` when deserializing a dictionary to an - :class:`~pystac.Item` or :class:`~pystac.Collection`. The - :meth:`~pystac.extensions.version.ignore_deprecated` context manager - is provided as a convenience to suppress these warnings: - - >>> with ignore_deprecated(): - ... deprecated_item = pystac.Item.from_dict(deprecated_item_dict) - """ - return self._get_property(DEPRECATED, bool) - - @deprecated.setter - def deprecated(self, v: bool | None) -> None: - self._set_property(DEPRECATED, v) - - @property - def latest(self) -> T | None: + def latest(self) -> U | None: """Gets or sets the :class:`~pystac.Link` to the :class:`~pystac.Item` representing the most recent version. """ return map_opt( - lambda x: cast(T, x), + lambda x: cast(U, x), next(iter(self.obj.get_stac_objects(VersionRelType.LATEST)), None), ) @latest.setter - def latest(self, item_or_collection: T | None) -> None: + def latest(self, value: U | None) -> None: self.obj.clear_links(VersionRelType.LATEST) - if item_or_collection is not None: - self.obj.add_link( - pystac.Link( - VersionRelType.LATEST, item_or_collection, pystac.MediaType.JSON - ) - ) + if value is not None: + self.obj.add_link(Link(VersionRelType.LATEST, value, MediaType.JSON)) @property - def predecessor(self) -> T | None: + def predecessor(self) -> U | None: """Gets or sets the :class:`~pystac.Link` to the :class:`~pystac.Item` representing the resource containing the predecessor version in the version history. """ return map_opt( - lambda x: cast(T, x), + lambda x: cast(U, x), next(iter(self.obj.get_stac_objects(VersionRelType.PREDECESSOR)), None), ) @predecessor.setter - def predecessor(self, item_or_collection: T | None) -> None: + def predecessor(self, value: U | None) -> None: self.obj.clear_links(VersionRelType.PREDECESSOR) - if item_or_collection is not None: + if value is not None: self.obj.add_link( - pystac.Link( + Link( VersionRelType.PREDECESSOR, - item_or_collection, - pystac.MediaType.JSON, + value, + MediaType.JSON, ) ) @property - def successor(self) -> T | None: + def successor(self) -> U | None: """Gets or sets the :class:`~pystac.Link` to the :class:`~pystac.Item` representing the resource containing the successor version in the version history. """ return map_opt( - lambda x: cast(T, x), + lambda x: cast(U, x), next(iter(self.obj.get_stac_objects(VersionRelType.SUCCESSOR)), None), ) @successor.setter - def successor(self, item_or_collection: T | None) -> None: + def successor(self, value: U | None) -> None: self.obj.clear_links(VersionRelType.SUCCESSOR) - if item_or_collection is not None: - self.obj.add_link( - pystac.Link( - VersionRelType.SUCCESSOR, item_or_collection, pystac.MediaType.JSON - ) - ) + if value is not None: + self.obj.add_link(Link(VersionRelType.SUCCESSOR, value, MediaType.JSON)) @classmethod - def get_schema_uri(cls) -> str: - return SCHEMA_URI - - @classmethod - def ext(cls, obj: T, add_if_missing: bool = False) -> VersionExtension[T]: + def ext(cls, obj: U, add_if_missing: bool = False) -> VersionExtension[U]: """Extends the given STAC Object with properties from the :stac-ext:`Versioning Indicators Extension `. @@ -221,17 +289,44 @@ def ext(cls, obj: T, add_if_missing: bool = False) -> VersionExtension[T]: pystac.ExtensionTypeError : If an invalid object type is passed. """ - if isinstance(obj, pystac.Collection): + if isinstance(obj, Collection): + cls.ensure_has_extension(obj, add_if_missing) + return cast(VersionExtension[U], CollectionVersionExtension(obj)) + elif isinstance(obj, Catalog): cls.ensure_has_extension(obj, add_if_missing) - return cast(VersionExtension[T], CollectionVersionExtension(obj)) - if isinstance(obj, pystac.Item): + return cast(VersionExtension[U], CatalogVersionExtension(obj)) + elif isinstance(obj, Item): cls.ensure_has_extension(obj, add_if_missing) - return cast(VersionExtension[T], ItemVersionExtension(obj)) + return cast(VersionExtension[U], ItemVersionExtension(obj)) else: - raise pystac.ExtensionTypeError(cls._ext_error_message(obj)) + raise ExtensionTypeError(cls._ext_error_message(obj)) -class CollectionVersionExtension(VersionExtension[pystac.Collection]): +class CatalogVersionExtension(VersionExtension[Catalog]): + """A concrete implementation of :class:`VersionExtension` on a + :class:`~pystac.Catalog` that extends the properties of the Catalog 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.Catalog` to extend it. + """ + + catalog: Catalog + links: list[Link] + properties: dict[str, Any] + + def __init__(self, catalog: Catalog): + self.catalog = catalog + self.properties = catalog.extra_fields + self.links = catalog.links + super().__init__(self.catalog) + + def __repr__(self) -> str: + return f"" + + +class CollectionVersionExtension(VersionExtension[Collection]): """A concrete implementation of :class:`VersionExtension` on a :class:`~pystac.Collection` that extends the properties of the Collection to include properties defined in the :stac-ext:`Versioning Indicators Extension @@ -241,11 +336,11 @@ class CollectionVersionExtension(VersionExtension[pystac.Collection]): :meth:`VersionExtension.ext` on an :class:`~pystac.Collection` to extend it. """ - collection: pystac.Collection - links: list[pystac.Link] + collection: Collection + links: list[Link] properties: dict[str, Any] - def __init__(self, collection: pystac.Collection): + def __init__(self, collection: Collection): self.collection = collection self.properties = collection.extra_fields self.links = collection.links @@ -255,7 +350,7 @@ def __repr__(self) -> str: return f"" -class ItemVersionExtension(VersionExtension[pystac.Item]): +class ItemVersionExtension(VersionExtension[Item]): """A concrete implementation of :class:`VersionExtension` on an :class:`~pystac.Item` that extends the properties of the Item to include properties defined in the :stac-ext:`Versioning Indicators Extension `. @@ -264,11 +359,11 @@ class ItemVersionExtension(VersionExtension[pystac.Item]): :meth:`VersionExtension.ext` on an :class:`~pystac.Item` to extend it. """ - item: pystac.Item - links: list[pystac.Link] + item: Item + links: list[Link] properties: dict[str, Any] - def __init__(self, item: pystac.Item): + def __init__(self, item: Item): self.item = item self.properties = item.properties self.links = item.links @@ -278,13 +373,49 @@ def __repr__(self) -> str: return f"" +class AssetVersionExtension(BaseVersionExtension[Asset]): + """A concrete implementation of :class:`VersionExtension` on an + :class:`~pystac.Asset` that extends the properties 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. + """ + + asset: Asset + properties: dict[str, Any] + + def __init__(self, asset: Asset): + self.asset = asset + self.properties = asset.extra_fields + + def __repr__(self) -> str: + return f"" + + +class ItemAssetsViewExtension(BaseVersionExtension[AssetDefinition]): + properties: dict[str, Any] + + def __init__(self, item_asset: AssetDefinition): + self.properties = item_asset.properties + + class VersionExtensionHooks(ExtensionHooks): schema_uri = SCHEMA_URI - prev_extension_ids = {"version"} - stac_object_types = {pystac.STACObjectType.COLLECTION, pystac.STACObjectType.ITEM} - - def get_object_links(self, so: pystac.STACObject) -> list[str] | None: - if isinstance(so, pystac.Collection) or isinstance(so, pystac.Item): + prev_extension_ids = { + "version", + "https://stac-extensions.github.io/version/v1.0.0/schema.json", + "https://stac-extensions.github.io/version/v1.1.0/schema.json", + } + stac_object_types = { + STACObjectType.COLLECTION, + STACObjectType.ITEM, + STACObjectType.CATALOG, + } + + def get_object_links(self, so: STACObject) -> list[str] | None: + if isinstance(so, Collection) or isinstance(so, Item): return [ VersionRelType.LATEST, VersionRelType.PREDECESSOR, 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 deleted file mode 100644 index 49f3e4a4a..000000000 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_deprecated_version.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: - - '517' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:50 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: - - '2' - X-Fastly-Request-ID: - - 8b9fffd9434fd81ec501ce6f8c825aa774cc06e7 - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21962-LGA - X-Timer: - - S1695849651.615996,VS0,VE1 - 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/CollectionVersionExtensionTest.test_add_not_deprecated_version.yaml b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_not_deprecated_version.yaml deleted file mode 100644 index aa857cea1..000000000 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_not_deprecated_version.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: - - '517' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:50 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: - - 5cc8b1daa791094130bd3d647375872983c7a593 - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21944-LGA - X-Timer: - - S1695849651.744949,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/CollectionVersionExtensionTest.test_add_version.yaml b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_version.yaml deleted file mode 100644 index b34cffd5a..000000000 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_version.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: - - '517' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:50 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: - - '2' - X-Fastly-Request-ID: - - d51a0034913bcb87930977d18078ba0ed2552e2a - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21944-LGA - X-Timer: - - S1695849651.859898,VS0,VE1 - 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/CollectionVersionExtensionTest.test_fail_validate.yaml b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_fail_validate.yaml deleted file mode 100644 index 1089f9093..000000000 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.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: - - '517' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:50 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: - - 8aa620895428e2051aaaba178500112e064afcd1 - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21935-LGA - X-Timer: - - S1695849651.980769,VS0,VE11 - 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/CollectionVersionExtensionTest.test_latest.yaml b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_latest.yaml deleted file mode 100644 index b7f65b084..000000000 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_latest.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: - - '518' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:51 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: - - '2' - X-Fastly-Request-ID: - - c68fdd17099afeb9fa2a41aaad460ada72e07f58 - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21953-LGA - X-Timer: - - S1695849651.160246,VS0,VE1 - 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/CollectionVersionExtensionTest.test_predecessor.yaml b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_predecessor.yaml deleted file mode 100644 index c6838680c..000000000 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_predecessor.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: - - '518' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:51 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: - - 461d7b8b0785d9d7b5ad98442cb43bb2cfc1b5d5 - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21952-LGA - X-Timer: - - S1695849651.289445,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/CollectionVersionExtensionTest.test_successor.yaml b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_successor.yaml deleted file mode 100644 index cfc6c7dbf..000000000 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_successor.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: - - '518' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:51 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: - - f0d6b9a4385e311b102ff903774db54d649a26a7 - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21968-LGA - X-Timer: - - S1695849651.421971,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/CollectionVersionExtensionTest.test_validate_all.yaml b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_validate_all.yaml deleted file mode 100644 index d2b4e44a7..000000000 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_validate_all.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: - - '518' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:51 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: - - bab94633646923df71cc7974a517a2f291754c77 - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21973-LGA - X-Timer: - - S1695849652.572206,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/CollectionVersionExtensionTest.test_version_deprecated.yaml b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_version_deprecated.yaml deleted file mode 100644 index 042b9562a..000000000 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_version_deprecated.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: - - '518' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:51 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: - - b9a3c67614808f15330b3f58d48c3cccd713e625 - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21954-LGA - X-Timer: - - S1695849652.706984,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_add_deprecated_version.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_deprecated_version.yaml deleted file mode 100644 index 81c865b80..000000000 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_deprecated_version.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: - - 8d49cb7e72d6110e2197d72dfcccd36016b39459 - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21971-LGA - X-Timer: - - S1695849649.351212,VS0,VE1 - 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_add_not_deprecated_version.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_not_deprecated_version.yaml deleted file mode 100644 index 1016aaa26..000000000 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_not_deprecated_version.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: - - 0d1710c11f74dd885ed23c36249d7cc7a99f4f60 - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21938-LGA - X-Timer: - - S1695849649.472479,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_add_version.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_version.yaml deleted file mode 100644 index 62102665e..000000000 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_version.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: - - 7268ba787ef0f580c134058a458e3a71dfec2e7a - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21956-LGA - X-Timer: - - S1695849650.608273,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_all_links.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_all_links.yaml deleted file mode 100644 index 1dc7361aa..000000000 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_all_links.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: - - 23409828487e62ce75feddb9098c346366ddc99d - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21962-LGA - X-Timer: - - S1695849650.736781,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_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 deleted file mode 100644 index b1df6a2d5..000000000 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_latest.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:50 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: - - 8803f491844c96a22564e51ecd5cdf1fbd6214b5 - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21947-LGA - X-Timer: - - S1695849650.041793,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_predecessor.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_predecessor.yaml deleted file mode 100644 index 3c1e3951a..000000000 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_predecessor.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: - - '517' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:50 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: - - 351e5d16b1673cf1be6b345ca7c427f93662b47f - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21928-LGA - X-Timer: - - S1695849650.203105,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_successor.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_successor.yaml deleted file mode 100644 index c218ee89c..000000000 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_successor.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: - - '517' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:50 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: - - b4f39da9a3d422da91576b6743202220c8c70f13 - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21965-LGA - X-Timer: - - S1695849650.349754,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_version_in_properties.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_version_in_properties.yaml deleted file mode 100644 index 3c835c4b3..000000000 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_version_in_properties.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: - - '517' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:50 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: - - c8757216a09cff172aa5f3dd6f582888f9420c7a - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21953-LGA - X-Timer: - - S1695849650.494674,VS0,VE1 - 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/test_add_deprecated_version.yaml b/tests/extensions/cassettes/test_version/test_add_deprecated_version.yaml new file mode 100644 index 000000000..f0ca78286 --- /dev/null +++ b/tests/extensions/cassettes/test_version/test_add_deprecated_version.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: + - '261' + Cache-Control: + - max-age=600 + Connection: + - close + Content-Length: + - '3405' + Content-Type: + - application/json; charset=utf-8 + Date: + - Fri, 13 Oct 2023 17:44:39 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: + - 204fa64116a495ddc5bd5a8db71004dbbb12c490 + X-GitHub-Request-Id: + - BC3A:66F5:8B5231:BC00EF:65297D31 + X-Served-By: + - cache-iad-kjyo7100146-IAD + X-Timer: + - S1697219079.418310,VS0,VE1 + expires: + - Fri, 13 Oct 2023 17:34:01 GMT + permissions-policy: + - interest-cohort=() + x-proxy-cache: + - MISS + status: + code: 200 + message: OK +version: 1 diff --git a/tests/extensions/cassettes/test_version/test_add_not_deprecated_version.yaml b/tests/extensions/cassettes/test_version/test_add_not_deprecated_version.yaml new file mode 100644 index 000000000..b58843f75 --- /dev/null +++ b/tests/extensions/cassettes/test_version/test_add_not_deprecated_version.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: + - '261' + Cache-Control: + - max-age=600 + Connection: + - close + Content-Length: + - '3405' + Content-Type: + - application/json; charset=utf-8 + Date: + - Fri, 13 Oct 2023 17:44:39 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: + - b588a1db93dbd4f7432a3aa0eb684b89fd38dc51 + X-GitHub-Request-Id: + - BC3A:66F5:8B5231:BC00EF:65297D31 + X-Served-By: + - cache-iad-kjyo7100020-IAD + X-Timer: + - S1697219079.268668,VS0,VE1 + expires: + - Fri, 13 Oct 2023 17:34:01 GMT + permissions-policy: + - interest-cohort=() + x-proxy-cache: + - MISS + status: + code: 200 + message: OK +version: 1 diff --git a/tests/extensions/cassettes/test_version/test_add_version.yaml b/tests/extensions/cassettes/test_version/test_add_version.yaml new file mode 100644 index 000000000..40b60f042 --- /dev/null +++ b/tests/extensions/cassettes/test_version/test_add_version.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: + - '261' + Cache-Control: + - max-age=600 + Connection: + - close + Content-Length: + - '3405' + Content-Type: + - application/json; charset=utf-8 + Date: + - Fri, 13 Oct 2023 17:44:38 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: + - a6018a9f820933db2a31d7ed4e7a4a0b1c625afb + X-GitHub-Request-Id: + - BC3A:66F5:8B5231:BC00EF:65297D31 + X-Served-By: + - cache-iad-kjyo7100103-IAD + X-Timer: + - S1697219079.974415,VS0,VE1 + expires: + - Fri, 13 Oct 2023 17:34:01 GMT + permissions-policy: + - interest-cohort=() + x-proxy-cache: + - MISS + status: + code: 200 + message: OK +version: 1 diff --git a/tests/extensions/cassettes/test_version/test_all_links.yaml b/tests/extensions/cassettes/test_version/test_all_links.yaml new file mode 100644 index 000000000..8ddd7769b --- /dev/null +++ b/tests/extensions/cassettes/test_version/test_all_links.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: + - '262' + Cache-Control: + - max-age=600 + Connection: + - close + Content-Length: + - '3405' + Content-Type: + - application/json; charset=utf-8 + Date: + - Fri, 13 Oct 2023 17:44:40 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: + - '2' + X-Fastly-Request-ID: + - 92a1fb595d46435abe57de3cb68667dae2980c94 + X-GitHub-Request-Id: + - BC3A:66F5:8B5231:BC00EF:65297D31 + X-Served-By: + - cache-iad-kjyo7100132-IAD + X-Timer: + - S1697219080.030833,VS0,VE1 + expires: + - Fri, 13 Oct 2023 17:34:01 GMT + permissions-policy: + - interest-cohort=() + x-proxy-cache: + - MISS + status: + code: 200 + message: OK +version: 1 diff --git a/tests/extensions/cassettes/test_version/test_assets.yaml b/tests/extensions/cassettes/test_version/test_assets.yaml new file mode 100644 index 000000000..718e72e94 --- /dev/null +++ b/tests/extensions/cassettes/test_version/test_assets.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: + - '0' + Cache-Control: + - max-age=600 + Connection: + - close + Content-Length: + - '3405' + Content-Type: + - application/json; charset=utf-8 + Date: + - Fri, 13 Oct 2023 18:54:28 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: + - e48db8b8c75160a36099f06adac070334e4ef547 + X-GitHub-Request-Id: + - BC3A:66F5:8B5231:BC00EF:65297D31 + X-Served-By: + - cache-iad-kjyo7100121-IAD + X-Timer: + - S1697223269.593787,VS0,VE1 + expires: + - Fri, 13 Oct 2023 17:34:01 GMT + permissions-policy: + - interest-cohort=() + x-proxy-cache: + - MISS + status: + code: 200 + message: OK +version: 1 diff --git a/tests/extensions/cassettes/test_version/test_catalog_add_version.yaml b/tests/extensions/cassettes/test_version/test_catalog_add_version.yaml new file mode 100644 index 000000000..e605d744b --- /dev/null +++ b/tests/extensions/cassettes/test_version/test_catalog_add_version.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: + - '263' + Cache-Control: + - max-age=600 + Connection: + - close + Content-Length: + - '3405' + Content-Type: + - application/json; charset=utf-8 + Date: + - Fri, 13 Oct 2023 17:44:40 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: + - 8a7558d783bc6fabe95747880f4a92586fc498f4 + X-GitHub-Request-Id: + - BC3A:66F5:8B5231:BC00EF:65297D31 + X-Served-By: + - cache-iad-kjyo7100178-IAD + X-Timer: + - S1697219081.574084,VS0,VE1 + expires: + - Fri, 13 Oct 2023 17:34:01 GMT + permissions-policy: + - interest-cohort=() + x-proxy-cache: + - MISS + status: + code: 200 + message: OK +version: 1 diff --git a/tests/extensions/cassettes/test_version/test_catalog_validate_all.yaml b/tests/extensions/cassettes/test_version/test_catalog_validate_all.yaml new file mode 100644 index 000000000..2dc7947d8 --- /dev/null +++ b/tests/extensions/cassettes/test_version/test_catalog_validate_all.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: + - '262' + Cache-Control: + - max-age=600 + Connection: + - close + Content-Length: + - '3405' + Content-Type: + - application/json; charset=utf-8 + Date: + - Fri, 13 Oct 2023 17:44:40 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: + - '2' + X-Fastly-Request-ID: + - 47ec0b7ee07ed76fee7ef595364fa2d174fd9653 + X-GitHub-Request-Id: + - BC3A:66F5:8B5231:BC00EF:65297D31 + X-Served-By: + - cache-iad-kjyo7100088-IAD + X-Timer: + - S1697219081.755987,VS0,VE0 + expires: + - Fri, 13 Oct 2023 17:34:01 GMT + permissions-policy: + - interest-cohort=() + x-proxy-cache: + - MISS + status: + code: 200 + message: OK +version: 1 diff --git a/tests/extensions/cassettes/test_version/test_collection_add_version.yaml b/tests/extensions/cassettes/test_version/test_collection_add_version.yaml new file mode 100644 index 000000000..340accccd --- /dev/null +++ b/tests/extensions/cassettes/test_version/test_collection_add_version.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: + - '262' + Cache-Control: + - max-age=600 + Connection: + - close + Content-Length: + - '3405' + Content-Type: + - application/json; charset=utf-8 + Date: + - Fri, 13 Oct 2023 17:44:40 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: + - 45e34d2c353da44c39e54c23e28650fd63726dbf + X-GitHub-Request-Id: + - BC3A:66F5:8B5231:BC00EF:65297D31 + X-Served-By: + - cache-iad-kjyo7100061-IAD + X-Timer: + - S1697219080.234421,VS0,VE1 + expires: + - Fri, 13 Oct 2023 17:34:01 GMT + permissions-policy: + - interest-cohort=() + x-proxy-cache: + - MISS + status: + code: 200 + message: OK +version: 1 diff --git a/tests/extensions/cassettes/test_version/test_collection_validate_all.yaml b/tests/extensions/cassettes/test_version/test_collection_validate_all.yaml new file mode 100644 index 000000000..2f922b4c1 --- /dev/null +++ b/tests/extensions/cassettes/test_version/test_collection_validate_all.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: + - '262' + Cache-Control: + - max-age=600 + Connection: + - close + Content-Length: + - '3405' + Content-Type: + - application/json; charset=utf-8 + Date: + - Fri, 13 Oct 2023 17:44:40 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: + - b346381ab99f2955b036e16c9718c2062538d5af + X-GitHub-Request-Id: + - BC3A:66F5:8B5231:BC00EF:65297D31 + X-Served-By: + - cache-iad-kjyo7100151-IAD + X-Timer: + - S1697219080.395381,VS0,VE1 + expires: + - Fri, 13 Oct 2023 17:34:01 GMT + permissions-policy: + - interest-cohort=() + x-proxy-cache: + - MISS + status: + code: 200 + message: OK +version: 1 diff --git a/tests/extensions/cassettes/test_version/test_latest.yaml b/tests/extensions/cassettes/test_version/test_latest.yaml new file mode 100644 index 000000000..48dcc9a53 --- /dev/null +++ b/tests/extensions/cassettes/test_version/test_latest.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: + - '262' + Cache-Control: + - max-age=600 + Connection: + - close + Content-Length: + - '3405' + Content-Type: + - application/json; charset=utf-8 + Date: + - Fri, 13 Oct 2023 17:44:39 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: + - 4f67bfa90700578bed9be5ba920a3445e0701234 + X-GitHub-Request-Id: + - BC3A:66F5:8B5231:BC00EF:65297D31 + X-Served-By: + - cache-iad-kjyo7100057-IAD + X-Timer: + - S1697219080.575266,VS0,VE2 + expires: + - Fri, 13 Oct 2023 17:34:01 GMT + permissions-policy: + - interest-cohort=() + x-proxy-cache: + - MISS + status: + code: 200 + message: OK +version: 1 diff --git a/tests/extensions/cassettes/test_version/test_optional_version.yaml b/tests/extensions/cassettes/test_version/test_optional_version.yaml new file mode 100644 index 000000000..534b0d560 --- /dev/null +++ b/tests/extensions/cassettes/test_version/test_optional_version.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: + - '0' + Cache-Control: + - max-age=600 + Connection: + - close + Content-Length: + - '3405' + Content-Type: + - application/json; charset=utf-8 + Date: + - Fri, 13 Oct 2023 18:54:28 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: + - b3f04a78185d177df880c879752146a06359fd53 + X-GitHub-Request-Id: + - BC3A:66F5:8B5231:BC00EF:65297D31 + X-Served-By: + - cache-iad-kjyo7100078-IAD + X-Timer: + - S1697223268.437872,VS0,VE9 + expires: + - Fri, 13 Oct 2023 17:34:01 GMT + permissions-policy: + - interest-cohort=() + x-proxy-cache: + - MISS + status: + code: 200 + message: OK +version: 1 diff --git a/tests/extensions/cassettes/test_version/test_predecessor.yaml b/tests/extensions/cassettes/test_version/test_predecessor.yaml new file mode 100644 index 000000000..d53c995fc --- /dev/null +++ b/tests/extensions/cassettes/test_version/test_predecessor.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: + - '262' + Cache-Control: + - max-age=600 + Connection: + - close + Content-Length: + - '3405' + Content-Type: + - application/json; charset=utf-8 + Date: + - Fri, 13 Oct 2023 17:44:39 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: + - 0f6558b34397da2ff2d3ddf9886ffece814b144b + X-GitHub-Request-Id: + - BC3A:66F5:8B5231:BC00EF:65297D31 + X-Served-By: + - cache-iad-kjyo7100132-IAD + X-Timer: + - S1697219080.721998,VS0,VE1 + expires: + - Fri, 13 Oct 2023 17:34:01 GMT + permissions-policy: + - interest-cohort=() + x-proxy-cache: + - MISS + status: + code: 200 + message: OK +version: 1 diff --git a/tests/extensions/cassettes/test_version/test_successor.yaml b/tests/extensions/cassettes/test_version/test_successor.yaml new file mode 100644 index 000000000..dab783b10 --- /dev/null +++ b/tests/extensions/cassettes/test_version/test_successor.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: + - '262' + Cache-Control: + - max-age=600 + Connection: + - close + Content-Length: + - '3405' + Content-Type: + - application/json; charset=utf-8 + Date: + - Fri, 13 Oct 2023 17:44:39 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: + - bc733955d25c5605029a639f002ca7f5871435cc + X-GitHub-Request-Id: + - BC3A:66F5:8B5231:BC00EF:65297D31 + X-Served-By: + - cache-iad-kjyo7100032-IAD + X-Timer: + - S1697219080.875413,VS0,VE1 + expires: + - Fri, 13 Oct 2023 17:34:01 GMT + permissions-policy: + - interest-cohort=() + x-proxy-cache: + - MISS + status: + code: 200 + message: OK +version: 1 diff --git a/tests/extensions/cassettes/test_version/test_version_in_properties.yaml b/tests/extensions/cassettes/test_version/test_version_in_properties.yaml new file mode 100644 index 000000000..f662b17b9 --- /dev/null +++ b/tests/extensions/cassettes/test_version/test_version_in_properties.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: + - '261' + Cache-Control: + - max-age=600 + Connection: + - close + Content-Length: + - '3405' + Content-Type: + - application/json; charset=utf-8 + Date: + - Fri, 13 Oct 2023 17:44:39 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: + - '2' + X-Fastly-Request-ID: + - ddba63a95f2cf18c93325734d1241de57e24ad05 + X-GitHub-Request-Id: + - BC3A:66F5:8B5231:BC00EF:65297D31 + X-Served-By: + - cache-iad-kjyo7100062-IAD + X-Timer: + - S1697219079.122135,VS0,VE0 + expires: + - Fri, 13 Oct 2023 17:34:01 GMT + permissions-policy: + - interest-cohort=() + x-proxy-cache: + - MISS + status: + code: 200 + message: OK +version: 1 diff --git a/tests/extensions/test_ext.py b/tests/extensions/test_ext.py index a4b89ac1d..c3fc10373 100644 --- a/tests/extensions/test_ext.py +++ b/tests/extensions/test_ext.py @@ -2,12 +2,13 @@ import pytest -import pystac +from pystac import Asset, Catalog, Collection, Item from pystac.errors import ExtensionNotImplemented from pystac.extensions.ext import ( EXTENSION_NAME_MAPPING, EXTENSION_NAMES, AssetExt, + CatalogExt, CollectionExt, ItemExt, ) @@ -18,12 +19,12 @@ @pytest.fixture -def eo_ext_item() -> pystac.Item: +def eo_ext_item() -> Item: ext_item_uri = get_data_file("eo/eo-landsat-example.json") - return pystac.Item.from_file(ext_item_uri) + return Item.from_file(ext_item_uri) -def test_ext_syntax_has(eo_ext_item: pystac.Item) -> None: +def test_ext_syntax_has(eo_ext_item: Item) -> None: assert eo_ext_item.ext.has("eo") is True assert eo_ext_item.ext.has("proj") is False @@ -31,22 +32,22 @@ def test_ext_syntax_has(eo_ext_item: pystac.Item) -> None: assert eo_ext_item.assets["B1"].ext.has("proj") is False -def test_ext_syntax_raises_if_ext_not_on_obj(eo_ext_item: pystac.Item) -> None: +def test_ext_syntax_raises_if_ext_not_on_obj(eo_ext_item: Item) -> None: with pytest.raises(ExtensionNotImplemented): eo_ext_item.ext.proj.epsg -def test_ext_syntax_ext_can_be_added(eo_ext_item: pystac.Item) -> None: +def test_ext_syntax_ext_can_be_added(eo_ext_item: Item) -> None: eo_ext_item.ext.add("proj") assert eo_ext_item.ext.proj.epsg is None -def test_ext_syntax_trying_to_add_invalid_ext_raises(item: pystac.Item) -> None: +def test_ext_syntax_trying_to_add_invalid_ext_raises(item: Item) -> None: with pytest.raises(KeyError, match="Extension 'foo' is not a valid extension"): item.ext.add("foo") # type: ignore -def test_ext_syntax_ext_can_be_removed(eo_ext_item: pystac.Item) -> None: +def test_ext_syntax_ext_can_be_removed(eo_ext_item: Item) -> None: original_n = len(eo_ext_item.stac_extensions) eo_ext_item.ext.remove("eo") with pytest.raises( @@ -71,11 +72,16 @@ def test_ext_syntax_ext_can_be_removed(eo_ext_item: pystac.Item) -> None: "add", "remove", } +all_catalog_ext_props = {a for a in dir(CatalogExt) if not a.startswith("_")} - { + "has", + "add", + "remove", +} @pytest.mark.parametrize("name", all_asset_ext_props) def test_ext_syntax_every_prop_can_be_added_to_asset( - asset: pystac.Asset, name: EXTENSION_NAMES + asset: Asset, name: EXTENSION_NAMES ) -> None: assert asset.ext.has(name) is False asset.ext.add(name) @@ -89,7 +95,7 @@ def test_ext_syntax_every_prop_can_be_added_to_asset( @pytest.mark.parametrize("name", all_item_ext_props) def test_ext_syntax_every_prop_can_be_added_to_item( - item: pystac.Item, name: EXTENSION_NAMES + item: Item, name: EXTENSION_NAMES ) -> None: assert item.ext.has(name) is False item.ext.add(name) @@ -103,7 +109,7 @@ def test_ext_syntax_every_prop_can_be_added_to_item( @pytest.mark.parametrize("name", all_collection_ext_props) def test_ext_syntax_every_prop_can_be_added_to_collection( - collection: pystac.Collection, name: EXTENSION_NAMES + collection: Collection, name: EXTENSION_NAMES ) -> None: assert collection.ext.has(name) is False collection.ext.add(name) @@ -115,6 +121,20 @@ def test_ext_syntax_every_prop_can_be_added_to_collection( getattr(collection.ext, name) +@pytest.mark.parametrize("name", all_catalog_ext_props) +def test_ext_syntax_every_prop_can_be_added_to_catalog( + catalog: Catalog, name: EXTENSION_NAMES +) -> None: + assert catalog.ext.has(name) is False + catalog.ext.add(name) + assert catalog.ext.has(name) is True + catalog.ext.remove(name) + with pytest.raises( + ExtensionNotImplemented, match=f"Extension '{name}' is not implemented" + ): + getattr(catalog.ext, name) + + def test_ext_syntax_every_name_has_a_prop() -> None: assert { *all_asset_ext_props, diff --git a/tests/extensions/test_version.py b/tests/extensions/test_version.py index 1d5641878..2e51f26b1 100644 --- a/tests/extensions/test_version.py +++ b/tests/extensions/test_version.py @@ -1,18 +1,25 @@ """Tests for pystac.extensions.version.""" -import unittest from collections.abc import Generator from datetime import datetime from typing import Optional import pytest -import pystac +from pystac import ( + Asset, + Catalog, + Collection, + ExtensionNotImplemented, + Extent, + Item, + SpatialExtent, + TemporalExtent, +) from pystac.errors import DeprecatedWarning, ExtensionTypeError -from pystac.extensions import version from pystac.extensions.version import ( - CollectionVersionExtension, - ItemVersionExtension, + DEPRECATED, + VERSION, VersionExtension, VersionRelType, ignore_deprecated, @@ -22,14 +29,37 @@ URL_TEMPLATE: str = "http://example.com/catalog/%s.json" -def make_item(year: int) -> pystac.Item: +@pytest.fixture +def item() -> Item: + return make_item(2011) + + +@pytest.fixture +def item_from_file() -> Item: + return Item.from_file(TestCases.get_path("data-files/version/item.json")) + + +@pytest.fixture +def collection() -> Collection: + return make_collection(2011) + + +@pytest.fixture +def catalog() -> Catalog: + return make_catalog(2011) + + +@pytest.fixture +def version() -> str: + return "1.2.3" + + +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) @@ -37,243 +67,17 @@ def make_item(year: int) -> pystac.Item: return item -class VersionExtensionTest(unittest.TestCase): - def test_should_raise_exception_when_passing_invalid_extension_object( - self, - ) -> None: - self.assertRaisesRegex( - ExtensionTypeError, - r"^VersionExtension does not apply to type 'object'$", - VersionExtension.ext, - object(), - ) - - -class ItemVersionExtensionTest(unittest.TestCase): - version: str = "1.2.3" - - def setUp(self) -> None: - super().setUp() - self.item = make_item(2011) - self.example_item_uri = TestCases.get_path("data-files/version/item.json") - - def test_rel_types(self) -> None: - self.assertEqual(VersionRelType.LATEST.value, "latest-version") - self.assertEqual(VersionRelType.PREDECESSOR.value, "predecessor-version") - self.assertEqual(VersionRelType.SUCCESSOR.value, "successor-version") - - def test_stac_extensions(self) -> None: - self.assertTrue(VersionExtension.has_extension(self.item)) - - @pytest.mark.vcr() - def test_add_version(self) -> None: - VersionExtension.ext(self.item).apply(self.version) - self.assertEqual(self.version, VersionExtension.ext(self.item).version) - self.assertNotIn(version.DEPRECATED, self.item.properties) - self.assertFalse(VersionExtension.ext(self.item).deprecated) - self.item.validate() - - @pytest.mark.vcr() - def test_version_in_properties(self) -> None: - VersionExtension.ext(self.item).apply(self.version, deprecated=True) - self.assertIn(version.VERSION, self.item.properties) - self.assertIn(version.DEPRECATED, self.item.properties) - self.item.validate() - - @pytest.mark.vcr() - def test_add_not_deprecated_version(self) -> None: - VersionExtension.ext(self.item).apply(self.version, deprecated=False) - self.assertIn(version.DEPRECATED, self.item.properties) - self.assertFalse(VersionExtension.ext(self.item).deprecated) - self.item.validate() - - @pytest.mark.vcr() - def test_add_deprecated_version(self) -> None: - VersionExtension.ext(self.item).apply(self.version, deprecated=True) - self.assertIn(version.DEPRECATED, self.item.properties) - self.assertTrue(VersionExtension.ext(self.item).deprecated) - self.item.validate() - - @pytest.mark.vcr() - def test_latest(self) -> None: - year = 2013 - latest = make_item(year) - VersionExtension.ext(self.item).apply(self.version, latest=latest) - latest_result = VersionExtension.ext(self.item).latest - self.assertIs(latest, latest_result) - - expected_href = URL_TEMPLATE % year - link = self.item.get_links(VersionRelType.LATEST)[0] - self.assertEqual(expected_href, link.get_href()) - self.item.validate() - - @pytest.mark.vcr() - def test_predecessor(self) -> None: - year = 2010 - predecessor = make_item(year) - VersionExtension.ext(self.item).apply(self.version, predecessor=predecessor) - predecessor_result = VersionExtension.ext(self.item).predecessor - self.assertIs(predecessor, predecessor_result) - - expected_href = URL_TEMPLATE % year - link = self.item.get_links(VersionRelType.PREDECESSOR)[0] - self.assertEqual(expected_href, link.get_href()) - self.item.validate() - - @pytest.mark.vcr() - def test_successor(self) -> None: - year = 2012 - successor = make_item(year) - VersionExtension.ext(self.item).apply(self.version, successor=successor) - successor_result = VersionExtension.ext(self.item).successor - self.assertIs(successor, successor_result) - - expected_href = URL_TEMPLATE % year - link = self.item.get_links(VersionRelType.SUCCESSOR)[0] - self.assertEqual(expected_href, link.get_href()) - self.item.validate() - - @pytest.mark.vcr() - def test_fail_validate(self) -> None: - with self.assertRaises(pystac.STACValidationError): - self.item.validate() - - @pytest.mark.vcr() - def test_all_links(self) -> None: - deprecated = True - latest = make_item(2013) - predecessor = make_item(2010) - successor = make_item(2012) - VersionExtension.ext(self.item).apply( - self.version, deprecated, latest, predecessor, successor - ) - self.item.validate() - - def test_full_copy(self) -> None: - cat = TestCases.case_1() - - # Fetch two items from the catalog - item1 = next(cat.get_items("area-1-1-imagery", recursive=True)) - item2 = next(cat.get_items("area-2-2-imagery", recursive=True)) - - # Enable the version extension on each, and link them - # as if they are different versions of the same Item - VersionExtension.add_to(item1) - VersionExtension.add_to(item2) - - VersionExtension.ext(item1).apply(version="2.0", predecessor=item2) - VersionExtension.ext(item2).apply(version="1.0", successor=item1, latest=item1) - - # Make a full copy of the catalog - cat_copy = cat.full_copy() - - # Retrieve the copied version of the items - item1_copy = next(cat_copy.get_items("area-1-1-imagery", recursive=True)) - item2_copy = next(cat_copy.get_items("area-2-2-imagery", recursive=True)) - - # Check to see if the version links point to the instances of the - # item objects as they should. - - predecessor = item1_copy.get_single_link(VersionRelType.PREDECESSOR) - assert predecessor is not None - predecessor_target = predecessor.target - successor = item2_copy.get_single_link(VersionRelType.SUCCESSOR) - assert successor is not None - successor_target = successor.target - latest = item2_copy.get_single_link(VersionRelType.LATEST) - assert latest is not None - latest_target = latest.target - - self.assertIs(predecessor_target, item2_copy) - self.assertIs(successor_target, item1_copy) - self.assertIs(latest_target, item1_copy) - - def test_setting_none_clears_link(self) -> None: - deprecated = False - latest = make_item(2013) - predecessor = make_item(2010) - successor = make_item(2012) - VersionExtension.ext(self.item).apply( - self.version, deprecated, latest, predecessor, successor - ) - - VersionExtension.ext(self.item).latest = None - links = self.item.get_links(VersionRelType.LATEST) - self.assertEqual(0, len(links)) - self.assertIsNone(VersionExtension.ext(self.item).latest) - - VersionExtension.ext(self.item).predecessor = None - links = self.item.get_links(VersionRelType.PREDECESSOR) - self.assertEqual(0, len(links)) - self.assertIsNone(VersionExtension.ext(self.item).predecessor) - - VersionExtension.ext(self.item).successor = None - links = self.item.get_links(VersionRelType.SUCCESSOR) - self.assertEqual(0, len(links)) - self.assertIsNone(VersionExtension.ext(self.item).successor) - - def test_multiple_link_setting(self) -> None: - deprecated = False - latest1 = make_item(2013) - predecessor1 = make_item(2010) - successor1 = make_item(2012) - VersionExtension.ext(self.item).apply( - self.version, deprecated, latest1, predecessor1, successor1 - ) - - year = 2015 - latest2 = make_item(year) - expected_href = URL_TEMPLATE % year - VersionExtension.ext(self.item).latest = latest2 - links = self.item.get_links(VersionRelType.LATEST) - self.assertEqual(1, len(links)) - self.assertEqual(expected_href, links[0].get_href()) - - year = 2009 - predecessor2 = make_item(year) - expected_href = URL_TEMPLATE % year - VersionExtension.ext(self.item).predecessor = predecessor2 - links = self.item.get_links(VersionRelType.PREDECESSOR) - self.assertEqual(1, len(links)) - self.assertEqual(expected_href, links[0].get_href()) - - year = 2014 - successor2 = make_item(year) - expected_href = URL_TEMPLATE % year - VersionExtension.ext(self.item).successor = successor2 - links = self.item.get_links(VersionRelType.SUCCESSOR) - self.assertEqual(1, len(links)) - self.assertEqual(expected_href, links[0].get_href()) - - 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.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.stac_extensions.remove(VersionExtension.get_schema_uri()) - self.assertNotIn(VersionExtension.get_schema_uri(), item.stac_extensions) - - _ = VersionExtension.ext(item, add_if_missing=True) - - self.assertIn(VersionExtension.get_schema_uri(), item.stac_extensions) - - -def make_collection(year: int) -> pystac.Collection: +def make_collection(year: int) -> Collection: asset_id = f"my/collection/of/things/{year}" start = datetime(2014, 8, 10) end = datetime(year, 1, 3, 4, 5) bboxes = [[-180.0, -90.0, 180.0, 90.0]] - spatial_extent = pystac.SpatialExtent(bboxes) + spatial_extent = SpatialExtent(bboxes) intervals: list[list[Optional[datetime]]] = [[start, end]] - temporal_extent = pystac.TemporalExtent(intervals) - extent = pystac.Extent(spatial_extent, temporal_extent) + temporal_extent = TemporalExtent(intervals) + extent = Extent(spatial_extent, temporal_extent) - collection = pystac.Collection(asset_id, "desc", extent) + collection = Collection(asset_id, "desc", extent) collection.set_self_href(URL_TEMPLATE % year) VersionExtension.add_to(collection) @@ -281,284 +85,404 @@ def make_collection(year: int) -> pystac.Collection: return collection -class CollectionVersionExtensionTest(unittest.TestCase): - version: str = "1.2.3" - - def setUp(self) -> None: - super().setUp() - self.collection = make_collection(2011) - self.example_collection_uri = TestCases.get_path( - "data-files/version/collection.json" - ) - - def test_stac_extensions(self) -> None: - self.assertTrue(VersionExtension.has_extension(self.collection)) - - @pytest.mark.vcr() - def test_add_version(self) -> None: - VersionExtension.ext(self.collection).apply(self.version) - self.assertEqual(self.version, VersionExtension.ext(self.collection).version) - self.assertNotIn(version.DEPRECATED, self.collection.extra_fields) - self.assertFalse(VersionExtension.ext(self.collection).deprecated) - self.collection.validate() - - @pytest.mark.vcr() - def test_version_deprecated(self) -> None: - VersionExtension.ext(self.collection).apply(self.version, deprecated=True) - self.assertIn(version.VERSION, self.collection.extra_fields) - self.assertIn(version.DEPRECATED, self.collection.extra_fields) - self.collection.validate() - - @pytest.mark.vcr() - def test_add_not_deprecated_version(self) -> None: - VersionExtension.ext(self.collection).apply(self.version, deprecated=False) - self.assertIn(version.DEPRECATED, self.collection.extra_fields) - self.assertFalse(VersionExtension.ext(self.collection).deprecated) - self.collection.validate() - - @pytest.mark.vcr() - def test_add_deprecated_version(self) -> None: - VersionExtension.ext(self.collection).apply(self.version, deprecated=True) - self.assertIn(version.DEPRECATED, self.collection.extra_fields) - self.assertTrue(VersionExtension.ext(self.collection).deprecated) - self.collection.validate() - - @pytest.mark.vcr() - def test_latest(self) -> None: - year = 2013 - latest = make_collection(year) - VersionExtension.ext(self.collection).apply(self.version, latest=latest) - latest_result = VersionExtension.ext(self.collection).latest - self.assertIs(latest, latest_result) - - expected_href = URL_TEMPLATE % year - link = self.collection.get_links(VersionRelType.LATEST)[0] - self.assertEqual(expected_href, link.get_href()) - self.collection.validate() - - @pytest.mark.vcr() - def test_predecessor(self) -> None: - year = 2010 - predecessor = make_collection(year) - VersionExtension.ext(self.collection).apply( - self.version, predecessor=predecessor - ) - predecessor_result = VersionExtension.ext(self.collection).predecessor - self.assertIs(predecessor, predecessor_result) - - expected_href = URL_TEMPLATE % year - link = self.collection.get_links(VersionRelType.PREDECESSOR)[0] - self.assertEqual(expected_href, link.get_href()) - self.collection.validate() - - @pytest.mark.vcr() - def test_successor(self) -> None: - year = 2012 - successor = make_collection(year) - VersionExtension.ext(self.collection).apply(self.version, successor=successor) - successor_result = VersionExtension.ext(self.collection).successor - self.assertIs(successor, successor_result) - - expected_href = URL_TEMPLATE % year - link = self.collection.get_links(VersionRelType.SUCCESSOR)[0] - self.assertEqual(expected_href, link.get_href()) - self.collection.validate() - - @pytest.mark.vcr() - def test_fail_validate(self) -> None: - with self.assertRaises(pystac.STACValidationError): - self.collection.validate() - - @pytest.mark.vcr() - def test_validate_all(self) -> None: - deprecated = True - latest = make_collection(2013) - predecessor = make_collection(2010) - successor = make_collection(2012) - VersionExtension.ext(self.collection).apply( - self.version, deprecated, latest, predecessor, successor - ) - self.collection.validate() - - def test_full_copy(self) -> None: - cat = TestCases.case_1() - - # Fetch two collections from the catalog - col1 = cat.get_child("area-1-1", recursive=True) - assert isinstance(col1, pystac.Collection) - col2 = cat.get_child("area-2-2", recursive=True) - assert isinstance(col2, pystac.Collection) - - # Enable the version extension on each, and link them - # as if they are different versions of the same Collection - VersionExtension.add_to(col1) - VersionExtension.add_to(col2) - - VersionExtension.ext(col1).apply(version="2.0", predecessor=col2) - VersionExtension.ext(col2).apply(version="1.0", successor=col1, latest=col1) - - # Make a full copy of the catalog - cat_copy = cat.full_copy() - - # Retrieve the copied version of the items - col1_copy = cat_copy.get_child("area-1-1", recursive=True) - assert col1_copy is not None - col2_copy = cat_copy.get_child("area-2-2", recursive=True) - assert col2_copy is not None - - # Check to see if the version links point to the instances of the - # col objects as they should. - predecessor = col1_copy.get_single_link(VersionRelType.PREDECESSOR) - assert predecessor is not None - predecessor_target = predecessor.target - successor = col2_copy.get_single_link(VersionRelType.SUCCESSOR) - assert successor is not None - successor_target = successor.target - latest = col2_copy.get_single_link(VersionRelType.LATEST) - assert latest is not None - latest_target = latest.target - - self.assertIs(predecessor_target, col2_copy) - self.assertIs(successor_target, col1_copy) - self.assertIs(latest_target, col1_copy) - - def test_setting_none_clears_link(self) -> None: - deprecated = False - latest = make_collection(2013) - predecessor = make_collection(2010) - successor = make_collection(2012) - VersionExtension.ext(self.collection).apply( - self.version, deprecated, latest, predecessor, successor - ) - - VersionExtension.ext(self.collection).latest = None - links = self.collection.get_links(VersionRelType.LATEST) - self.assertEqual(0, len(links)) - self.assertIsNone(VersionExtension.ext(self.collection).latest) - - VersionExtension.ext(self.collection).predecessor = None - links = self.collection.get_links(VersionRelType.PREDECESSOR) - self.assertEqual(0, len(links)) - self.assertIsNone(VersionExtension.ext(self.collection).predecessor) - - VersionExtension.ext(self.collection).successor = None - links = self.collection.get_links(VersionRelType.SUCCESSOR) - self.assertEqual(0, len(links)) - self.assertIsNone(VersionExtension.ext(self.collection).successor) - - def test_multiple_link_setting(self) -> None: - deprecated = False - latest1 = make_collection(2013) - predecessor1 = make_collection(2010) - successor1 = make_collection(2012) - VersionExtension.ext(self.collection).apply( - self.version, deprecated, latest1, predecessor1, successor1 - ) - - year = 2015 - latest2 = make_collection(year) - expected_href = URL_TEMPLATE % year - VersionExtension.ext(self.collection).latest = latest2 - links = self.collection.get_links(VersionRelType.LATEST) - self.assertEqual(1, len(links)) - self.assertEqual(expected_href, links[0].get_href()) - - year = 2009 - predecessor2 = make_collection(year) - expected_href = URL_TEMPLATE % year - VersionExtension.ext(self.collection).predecessor = predecessor2 - links = self.collection.get_links(VersionRelType.PREDECESSOR) - self.assertEqual(1, len(links)) - self.assertEqual(expected_href, links[0].get_href()) - - year = 2014 - successor2 = make_collection(year) - expected_href = URL_TEMPLATE % year - VersionExtension.ext(self.collection).successor = successor2 - links = self.collection.get_links(VersionRelType.SUCCESSOR) - self.assertEqual(1, len(links)) - self.assertEqual(expected_href, links[0].get_href()) - - def test_extension_not_implemented(self) -> None: - # Should raise exception if Collection does not include extension URI - with ignore_deprecated(): - collection = pystac.Collection.from_file(self.example_collection_uri) - collection.stac_extensions.remove(VersionExtension.get_schema_uri()) - - with self.assertRaises(pystac.ExtensionNotImplemented): - _ = VersionExtension.ext(collection) - - def test_ext_add_to(self) -> None: - with ignore_deprecated(): - collection = pystac.Collection.from_file(self.example_collection_uri) - collection.stac_extensions.remove(VersionExtension.get_schema_uri()) - self.assertNotIn(VersionExtension.get_schema_uri(), collection.stac_extensions) - - _ = VersionExtension.ext(collection, add_if_missing=True) - - self.assertIn(VersionExtension.get_schema_uri(), collection.stac_extensions) +def make_catalog(year: int) -> Catalog: + """Create basic test catalogs that are only slightly different.""" + asset_id = f"USGS/GAP/CONUS/{year}" + + catalog = Catalog(id=asset_id, description=str(year)) + VersionExtension.add_to(catalog) + + return catalog + + +def test_should_raise_exception_when_passing_invalid_extension_object() -> None: + with pytest.raises( + ExtensionTypeError, match="^VersionExtension does not apply to type 'object'$" + ): + VersionExtension.ext(object()) # type: ignore + + +def test_rel_types() -> None: + assert VersionRelType.LATEST.value == "latest-version" + assert VersionRelType.PREDECESSOR.value == "predecessor-version" + assert VersionRelType.SUCCESSOR.value == "successor-version" + + +def test_stac_extensions(item: Item) -> None: + assert item.ext.has("version") + + +@pytest.mark.vcr() +def test_add_version(item: Item, version: str) -> None: + item.ext.version.apply(version) + assert version == item.ext.version.version + assert DEPRECATED not in item.properties + assert not item.ext.version.deprecated + item.validate() + + +@pytest.mark.vcr() +def test_version_in_properties(item: Item, version: str) -> None: + item.ext.version.apply(version, deprecated=True) + assert VERSION in item.properties + assert DEPRECATED in item.properties + item.validate() + + +@pytest.mark.vcr() +def test_add_not_deprecated_version(item: Item, version: str) -> None: + item.ext.version.apply(version, deprecated=False) + assert DEPRECATED in item.properties + assert not item.ext.version.deprecated + item.validate() + + +@pytest.mark.vcr() +def test_add_deprecated_version(item: Item, version: str) -> None: + item.ext.version.apply(version, deprecated=True) + assert DEPRECATED in item.properties + assert item.ext.version.deprecated + item.validate() + + +@pytest.mark.vcr() +def test_latest(item: Item, version: str) -> None: + year = 2013 + latest = make_item(year) + item.ext.version.apply(version, latest=latest) + assert item.ext.version.latest is latest + expected_href = URL_TEMPLATE % year + link = item.get_links(VersionRelType.LATEST)[0] + assert expected_href == link.get_href() + item.validate() + + +@pytest.mark.vcr() +def test_predecessor(item: Item, version: str) -> None: + year = 2010 + predecessor = make_item(year) + item.ext.version.apply(version, predecessor=predecessor) + assert item.ext.version.predecessor is predecessor + expected_href = URL_TEMPLATE % year + link = item.get_links(VersionRelType.PREDECESSOR)[0] + assert expected_href == link.get_href() + item.validate() + + +@pytest.mark.vcr() +def test_successor(item: Item, version: str) -> None: + year = 2012 + successor = make_item(year) + item.ext.version.apply(version, successor=successor) + assert item.ext.version.successor is successor + expected_href = URL_TEMPLATE % year + link = item.get_links(VersionRelType.SUCCESSOR)[0] + assert expected_href == link.get_href() + item.validate() + + +@pytest.mark.vcr() +def test_all_links(item: Item, version: str) -> None: + deprecated = True + latest = make_item(2013) + predecessor = make_item(2010) + successor = make_item(2012) + item.ext.version.apply( + version, + deprecated=deprecated, + latest=latest, + predecessor=predecessor, + successor=successor, + ) + item.validate() + + +def test_full_copy(test_case_1_catalog: Catalog) -> None: + # Fetch two items from the catalog + item1 = next(test_case_1_catalog.get_items("area-1-1-imagery", recursive=True)) + item2 = next(test_case_1_catalog.get_items("area-2-2-imagery", recursive=True)) + + # Enable the version extension on each, and link them + # as if they are different versions of the same Item + item1.ext.add("version") + item2.ext.add("version") + + item1.ext.version.apply(version="2.0", predecessor=item2) + item2.ext.version.apply(version="1.0", successor=item1, latest=item1) + + # Make a full copy of the catalog + cat_copy = test_case_1_catalog.full_copy() + + # Retrieve the copied version of the items + item1_copy = next(cat_copy.get_items("area-1-1-imagery", recursive=True)) + item2_copy = next(cat_copy.get_items("area-2-2-imagery", recursive=True)) + + # Check to see if the version links point to the instances of the + # item objects as they should. + + predecessor = item1_copy.get_single_link(VersionRelType.PREDECESSOR) + assert predecessor is not None + predecessor_target = predecessor.target + successor = item2_copy.get_single_link(VersionRelType.SUCCESSOR) + assert successor is not None + successor_target = successor.target + latest = item2_copy.get_single_link(VersionRelType.LATEST) + assert latest is not None + latest_target = latest.target + + assert predecessor_target is item2_copy + assert successor_target is item1_copy + assert latest_target is item1_copy + + +def test_setting_none_clears_link(item: Item, version: str) -> None: + deprecated = False + latest = make_item(2013) + predecessor = make_item(2010) + successor = make_item(2012) + item.ext.version.apply( + version, deprecated, latest=latest, predecessor=predecessor, successor=successor + ) + + item.ext.version.latest = None + links = item.get_links(VersionRelType.LATEST) + assert 0 == len(links) + + item.ext.version.predecessor = None + links = item.get_links(VersionRelType.PREDECESSOR) + assert 0 == len(links) + + item.ext.version.successor = None + links = item.get_links(VersionRelType.SUCCESSOR) + assert 0 == len(links) + + +def test_multiple_link_setting(item: Item, version: str) -> None: + deprecated = False + latest1 = make_item(2013) + predecessor1 = make_item(2010) + successor1 = make_item(2012) + item.ext.version.apply( + version, + deprecated, + latest=latest1, + predecessor=predecessor1, + successor=successor1, + ) + + year = 2015 + latest2 = make_item(year) + expected_href = URL_TEMPLATE % year + item.ext.version.latest = latest2 + links = item.get_links(VersionRelType.LATEST) + assert 1 == len(links) + assert expected_href == links[0].get_href() + + year = 2009 + predecessor2 = make_item(year) + expected_href = URL_TEMPLATE % year + item.ext.version.predecessor = predecessor2 + links = item.get_links(VersionRelType.PREDECESSOR) + assert 1 == len(links) + assert expected_href == links[0].get_href() + + year = 2014 + successor2 = make_item(year) + expected_href = URL_TEMPLATE % year + item.ext.version.successor = successor2 + links = item.get_links(VersionRelType.SUCCESSOR) + assert 1 == len(links) + assert expected_href == links[0].get_href() + + +def test_extension_not_implemented(item_from_file: Item) -> None: + # Should raise exception if Item does not include extension URI + item_from_file.stac_extensions.remove(VersionExtension.get_schema_uri()) + with pytest.raises(ExtensionNotImplemented): + item_from_file.ext.version + + +def test_ext_add_to(item_from_file: Item) -> None: + item_from_file.stac_extensions.remove(VersionExtension.get_schema_uri()) + item_from_file.ext.add("version") + assert VersionExtension.get_schema_uri() in item_from_file.stac_extensions + + +def test_collection_stac_extensions(collection: Collection) -> None: + assert collection.ext.has("version") + + +@pytest.mark.vcr() +def test_collection_add_version(collection: Collection, version: str) -> None: + collection.ext.version.apply(version) + assert collection.ext.version.version == version + assert DEPRECATED not in collection.extra_fields + collection.validate() + + +@pytest.mark.vcr() +def test_collection_validate_all(collection: Collection, version: str) -> None: + deprecated = True + latest = make_collection(2013) + predecessor = make_collection(2010) + successor = make_collection(2012) + collection.ext.version.apply( + version, deprecated, latest=latest, predecessor=predecessor, successor=successor + ) + + links = collection.get_links(VersionRelType.LATEST) + assert 1 == len(links) + links = collection.get_links(VersionRelType.PREDECESSOR) + assert 1 == len(links) + links = collection.get_links(VersionRelType.SUCCESSOR) + assert 1 == len(links) + + collection.validate() + + +def test_catalog_stac_extensions(catalog: Catalog) -> None: + assert catalog.ext.has("version") + + +@pytest.mark.vcr() +def test_catalog_add_version(catalog: Catalog, version: str) -> None: + catalog.ext.version.apply(version) + assert catalog.ext.version.version == version + assert DEPRECATED not in catalog.extra_fields + catalog.validate() + + +@pytest.mark.vcr() +def test_catalog_validate_all(catalog: Catalog, version: str) -> None: + deprecated = True + latest = make_collection(2013) + predecessor = make_collection(2010) + successor = make_collection(2012) + catalog.ext.version.apply( + version, deprecated, latest=latest, predecessor=predecessor, successor=successor + ) + + links = catalog.get_links(VersionRelType.LATEST) + assert 1 == len(links) + links = catalog.get_links(VersionRelType.PREDECESSOR) + assert 1 == len(links) + links = catalog.get_links(VersionRelType.SUCCESSOR) + assert 1 == len(links) + + catalog.validate() 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.ext.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) + with pytest.warns(DeprecatedWarning, match="The item '.*' is deprecated."): + _ = Item.from_dict(item_dict) - version.deprecated = False + item.ext.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.ext.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.ext.remove("version") item_dict = item.to_dict() - _ = pystac.Item.from_dict(item_dict) + _ = Item.from_dict(item_dict) assert len(list(recwarn)) == 0 def test_collection_deprecation_warning( - collection: pystac.Collection, + collection: Collection, recwarn: Generator[pytest.WarningsRecorder, None, None], ) -> None: - version = CollectionVersionExtension.ext(collection, add_if_missing=True) - version.deprecated = True + collection.ext.version.deprecated = True collection_dict = collection.to_dict() - with pytest.warns( - DeprecatedWarning, match="The collection 'test-collection' is deprecated." - ): - _ = pystac.Collection.from_dict(collection_dict) + with pytest.warns(DeprecatedWarning, match="The collection '.*' is deprecated."): + _ = Collection.from_dict(collection_dict) - version.deprecated = False - collection.extra_fields["deprecated"] = False + collection.ext.version.deprecated = False collection_dict = collection.to_dict() - _ = pystac.Collection.from_dict(collection_dict) + _ = Collection.from_dict(collection_dict) assert len(list(recwarn)) == 0 - version.deprecated = None + collection.ext.version.deprecated = None collection_dict = collection.to_dict() - _ = pystac.Collection.from_dict(collection_dict) + _ = Collection.from_dict(collection_dict) assert len(list(recwarn)) == 0 - CollectionVersionExtension.remove_from(collection) + collection.ext.remove("version") collection_dict = collection.to_dict() - _ = pystac.Collection.from_dict(collection_dict) + _ = Collection.from_dict(collection_dict) assert len(list(recwarn)) == 0 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 item_dict = item.to_dict() with ignore_deprecated(): - _ = pystac.Item.from_dict(item_dict) + _ = Item.from_dict(item_dict) assert len(list(recwarn)) == 0 + + +def test_experimental(item: Item) -> None: + # Added in v1.2.0 + assert item.ext.version.experimental is None + assert "experimental" not in item.properties + item.ext.version.experimental = True + assert item.ext.version.experimental + assert item.properties["experimental"] + item.ext.version.experimental = False + assert not item.properties["experimental"] + item.ext.version.experimental = None + assert "experimental" not in item.properties + + +@pytest.mark.vcr +def test_optional_version(item: Item) -> None: + # Changed in v1.1.0 + assert item.ext.version.version is None + assert "version" not in item.properties + item.validate() + item.ext.version.version = "final_final_2" + assert "version" in item.properties + item.ext.version.version = None + assert "version" not in item.properties + + +@pytest.mark.vcr +def test_assets(item: Item) -> None: + item.ext.remove("version") + asset = Asset("example.tif") + item.add_asset("data", asset) + + assert not asset.ext.has("version") + asset.ext.add("version") + assert asset.ext.has("version") + assert item.ext.has("version") + + asset.ext.version.version = "final_final_2" + assert asset.ext.version.version == "final_final_2" + assert "version" in asset.extra_fields + + item.validate() + + +@pytest.mark.parametrize("version", ["v1.0.0", "v1.1.0"]) +def test_migrate(version: str, item: Item) -> None: + item_dict = item.to_dict(include_self_link=False, transform_hrefs=False) + item_dict["stac_extensions"] = [ + f"https://stac-extensions.github.io/version/{version}/schema.json" + ] + item = Item.from_dict(item_dict, migrate=True) + assert ( + "https://stac-extensions.github.io/version/v1.2.0/schema.json" + in item.stac_extensions + )