Skip to content

Commit f682826

Browse files
Merge pull request #140 from vincentsarago/patch/type-is-required
remove default for Types
2 parents 556e668 + a927d25 commit f682826

9 files changed

+15
-2
lines changed

Diff for: CHANGELOG.txt

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Rename `stac_pydantic.api.conformance.ConformanceClasses` to `stac_pydantic.api.conformance.Conformance`
55
- Update pre-commit configuration and switch to astral-sh/ruff for linter and formater
66
- Add official support for python 3.12
7+
- Enforce required `type` key for `Collection` and `Catalog` models
78

89
3.0.0 (2024-01-25)
910
------------------

Diff for: stac_pydantic/catalog.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ class _Catalog(StacBaseModel):
2323

2424

2525
class Catalog(_Catalog):
26-
type: Literal["Catalog"] = "Catalog"
26+
type: Literal["Catalog"]

Diff for: stac_pydantic/collection.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ class Collection(_Catalog):
5252
keywords: Optional[List[str]] = None
5353
providers: Optional[List[Provider]] = None
5454
summaries: Optional[Dict[str, Union[Range, List[Any], Dict[str, Any]]]] = None
55-
type: Literal["Collection"] = "Collection"
55+
type: Literal["Collection"]

Diff for: tests/api/examples/v1.0.0/example-collection-list.json

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"id":"aster-l1t",
1717
"description":"The [ASTER](https://terra.nasa.gov/about/terra-instruments/aster) instrument, launched on-board NASA's [Terra](https://terra.nasa.gov/) satellite in 1999, provides multispectral images of the Earth at 15m-90m resolution. ASTER images provide information about land surface temperature, color, elevation, and mineral composition.\n\nThis dataset represents ASTER [L1T](https://lpdaac.usgs.gov/products/ast_l1tv003/) data from 2000-2006. L1T images have been terrain-corrected and rotated to a north-up UTM projection. Images are in [cloud-optimized GeoTIFF](https://www.cogeo.org/) format.\n",
1818
"stac_version":"1.0.0",
19+
"type": "Collection",
1920
"links":[
2021
{
2122
"href":"https://planetarycomputer.microsoft.com/api/stac/v1/collections/aster-l1t",
@@ -408,6 +409,7 @@
408409
"id":"landsat-8-c2-l2",
409410
"description":"The [Landsat](https://landsat.gsfc.nasa.gov/) program has been imaging the Earth since 1972; it provides a comprehensive, continuous archive of the Earth's surface. [Landsat 8](https://www.usgs.gov/core-science-systems/nli/landsat/landsat-8) is the most recent satellite in the Landsat series. Launched in 2013, Landsat 8 captures data in eleven spectral bands: ten optical/IR bands from the [Operational Land Imager](https://landsat.gsfc.nasa.gov/landsat-8/operational-land-imager) (OLI) instrument, and two thermal bands from the [Thermal Infrared Sensor](https://landsat.gsfc.nasa.gov/landsat-8/thermal-infrared-sensor-tirs) (TIRS) instrument.\n\nThis dataset represents the global archive of Level-2 Landsat 8 data from [Landsat Collection 2](https://www.usgs.gov/core-science-systems/nli/landsat/landsat-collection-2). Because there is some latency before Level-2 data is available, a rolling window of recent Level-1 data is available as well. Images are stored in [cloud-optimized GeoTIFF](https://www.cogeo.org/) format.\n",
410411
"stac_version":"1.0.0",
412+
"type": "Collection",
411413
"links":[
412414
{
413415
"href":"https://planetarycomputer.microsoft.com/api/stac/v1/collections/landsat-8-c2-l2",
@@ -874,6 +876,7 @@
874876
"id":"sentinel-2-l2a",
875877
"description":"The [Sentinel-2](https://sentinel.esa.int/web/sentinel/missions/sentinel-2) program provides global imagery in thirteen spectral bands at 10m-60m resolution and a revisit time of approximately five days. This dataset represents the global Sentinel-2 archive, from 2016 to the present, processed to L2A (bottom-of-atmosphere) using [Sen2Cor](https://step.esa.int/main/snap-supported-plugins/sen2cor/) and converted to [cloud-optimized GeoTIFF](https://www.cogeo.org/) format.",
876878
"stac_version":"1.0.0",
879+
"type": "Collection",
877880
"links":[
878881
{
879882
"href":"https://planetarycomputer.microsoft.com/api/stac/v1/collections/sentinel-2-l2a",
@@ -1499,6 +1502,7 @@
14991502
"id":"naip",
15001503
"description":"The [National Agriculture Imagery Program](https://www.fsa.usda.gov/programs-and-services/aerial-photography/imagery-programs/naip-imagery/) (NAIP) provides US-wide, high-resolution aerial imagery, with four spectral bands (R, G, B, IR). NAIP is administered by the [Aerial Field Photography Office](https://www.fsa.usda.gov/programs-and-services/aerial-photography/) (AFPO) within the [US Department of Agriculture](https://www.usda.gov/) (USDA). Data are captured at least once every three years for each state. This dataset represents NAIP data from 2010-present, in [cloud-optimized GeoTIFF](https://www.cogeo.org/) format.\n",
15011504
"stac_version":"1.0.0",
1505+
"type": "Collection",
15021506
"links":[
15031507
{
15041508
"href":"https://planetarycomputer.microsoft.com/api/stac/v1/collections/naip",

Diff for: tests/api/test_landing_page.py

+2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def test_schema(example_url, schema_url):
7171

7272
def test_api_landing_page():
7373
LandingPage(
74+
type="Catalog",
7475
id="test-landing-page",
7576
description="stac-api landing page",
7677
stac_extensions=[
@@ -100,6 +101,7 @@ def test_api_landing_page():
100101

101102
def test_api_landing_page_is_catalog():
102103
landing_page = LandingPage(
104+
type="Catalog",
103105
id="test-landing-page",
104106
description="stac-api landing page",
105107
stac_extensions=[

Diff for: tests/example_stac/example-collection-list.json

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"id":"aster-l1t",
1212
"description":"The [ASTER](https://terra.nasa.gov/about/terra-instruments/aster) instrument, launched on-board NASA's [Terra](https://terra.nasa.gov/) satellite in 1999, provides multispectral images of the Earth at 15m-90m resolution. ASTER images provide information about land surface temperature, color, elevation, and mineral composition.\n\nThis dataset represents ASTER [L1T](https://lpdaac.usgs.gov/products/ast_l1tv003/) data from 2000-2006. L1T images have been terrain-corrected and rotated to a north-up UTM projection. Images are in [cloud-optimized GeoTIFF](https://www.cogeo.org/) format.\n",
1313
"stac_version":"1.0.0",
14+
"type": "Collection",
1415
"links":[
1516
{
1617
"href":"https://planetarycomputer.microsoft.com/api/stac/v1/collections/aster-l1t",
@@ -403,6 +404,7 @@
403404
"id":"landsat-8-c2-l2",
404405
"description":"The [Landsat](https://landsat.gsfc.nasa.gov/) program has been imaging the Earth since 1972; it provides a comprehensive, continuous archive of the Earth's surface. [Landsat 8](https://www.usgs.gov/core-science-systems/nli/landsat/landsat-8) is the most recent satellite in the Landsat series. Launched in 2013, Landsat 8 captures data in eleven spectral bands: ten optical/IR bands from the [Operational Land Imager](https://landsat.gsfc.nasa.gov/landsat-8/operational-land-imager) (OLI) instrument, and two thermal bands from the [Thermal Infrared Sensor](https://landsat.gsfc.nasa.gov/landsat-8/thermal-infrared-sensor-tirs) (TIRS) instrument.\n\nThis dataset represents the global archive of Level-2 Landsat 8 data from [Landsat Collection 2](https://www.usgs.gov/core-science-systems/nli/landsat/landsat-collection-2). Because there is some latency before Level-2 data is available, a rolling window of recent Level-1 data is available as well. Images are stored in [cloud-optimized GeoTIFF](https://www.cogeo.org/) format.\n",
405406
"stac_version":"1.0.0",
407+
"type": "Collection",
406408
"links":[
407409
{
408410
"href":"https://planetarycomputer.microsoft.com/api/stac/v1/collections/landsat-8-c2-l2",
@@ -1494,6 +1496,7 @@
14941496
"id":"naip",
14951497
"description":"The [National Agriculture Imagery Program](https://www.fsa.usda.gov/programs-and-services/aerial-photography/imagery-programs/naip-imagery/) (NAIP) provides US-wide, high-resolution aerial imagery, with four spectral bands (R, G, B, IR). NAIP is administered by the [Aerial Field Photography Office](https://www.fsa.usda.gov/programs-and-services/aerial-photography/) (AFPO) within the [US Department of Agriculture](https://www.usda.gov/) (USDA). Data are captured at least once every three years for each state. This dataset represents NAIP data from 2010-present, in [cloud-optimized GeoTIFF](https://www.cogeo.org/) format.\n",
14961498
"stac_version":"1.0.0",
1499+
"type": "Collection",
14971500
"links":[
14981501
{
14991502
"href":"https://planetarycomputer.microsoft.com/api/stac/v1/collections/naip",

Diff for: tests/example_stac/example-collection_version-extension.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"stac_version": "1.0.0",
33
"stac_extensions": ["https://stac-extensions.github.io/version/v1.0.0/schema.json"],
4+
"type": "Collection",
45
"id": "merraclim",
56
"title": "MERRAclim",
67
"description": "A high-resolution global dataset of remotely sensed bioclimatic variables for ecological modelling.",

Diff for: tests/example_stac/example-landsat8_item-assets-extension.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"id": "landsat-8-l1",
33
"title": "Landsat 8 L1",
4+
"type": "Collection",
45
"description": "Landat 8 imagery radiometrically calibrated and orthorectified using gound points and Digital Elevation Model (DEM) data to correct relief displacement.",
56
"keywords": [
67
"landsat",

Diff for: tests/example_stac/landsat-collection.json

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"stac_extensions": [],
44
"id": "landsat-8-l1",
55
"title": "Landsat 8 L1",
6+
"type": "Collection",
67
"description": "Landat 8 imagery radiometrically calibrated and orthorectified using gound points and Digital Elevation Model (DEM) data to correct relief displacement.",
78
"keywords": [
89
"landsat"

0 commit comments

Comments
 (0)