{"id":13735116,"url":"https://github.com/stac-utils/stac-validator","last_synced_at":"2025-06-23T17:12:31.281Z","repository":{"id":40424862,"uuid":"144780846","full_name":"stac-utils/stac-validator","owner":"stac-utils","description":"Validator for the stac-spec","archived":false,"fork":false,"pushed_at":"2024-10-09T06:28:29.000Z","size":17784,"stargazers_count":46,"open_issues_count":8,"forks_count":27,"subscribers_count":17,"default_branch":"main","last_synced_at":"2024-11-09T16:49:15.877Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stac-utils.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-14T23:07:14.000Z","updated_at":"2024-10-14T15:40:55.000Z","dependencies_parsed_at":"2023-12-18T20:13:26.847Z","dependency_job_id":"58e8a8d9-de60-4259-8a85-c44145b5cf71","html_url":"https://github.com/stac-utils/stac-validator","commit_stats":{"total_commits":667,"total_committers":18,"mean_commits":37.05555555555556,"dds":"0.26236881559220393","last_synced_commit":"5ff49445ad4622fbc2b11ba3989b4d7b12cef9ef"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stac-utils%2Fstac-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stac-utils%2Fstac-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stac-utils%2Fstac-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stac-utils%2Fstac-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stac-utils","download_url":"https://codeload.github.com/stac-utils/stac-validator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224727173,"owners_count":17359532,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T03:01:03.155Z","updated_at":"2025-06-23T17:12:31.270Z","avatar_url":"https://github.com/stac-utils.png","language":"HTML","funding_links":[],"categories":["`Python` processing of optical imagery (non deep learning)"],"sub_categories":["Cloud Native Geospatial"],"readme":"# SpatioTemporal Asset Catalog Validator\n\n\u003c!-- markdownlint-disable MD033 MD041 --\u003e\n\n\u003cp align=\"left\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/stac-utils/stac-validator/main/assets/stac-validator.png\" width=560\u003e\n\u003c/p\u003e\n\n[![PyPI Downloads](https://static.pepy.tech/badge/stac-validator/month)](https://pepy.tech/projects/stac-validator)\n  [![GitHub contributors](https://img.shields.io/github/contributors/stac-utils/stac-validator?color=blue)](https://github.com/stac-utils/stac-validator/graphs/contributors)\n  [![GitHub stars](https://img.shields.io/github/stars/stac-utils/stac-validator.svg?color=blue)](https://github.com/stac-utils/stac-validator/stargazers)\n  [![GitHub forks](https://img.shields.io/github/forks/stac-utils/stac-validator.svg?color=blue)](https://github.com/stac-utils/stac-validator/network/members)\n   [![PyPI version](https://img.shields.io/pypi/v/stac-validator.svg?color=blue)](https://pypi.org/project/stac-validator/)\n  [![STAC](https://img.shields.io/badge/STAC-1.1.0-blue.svg)](https://github.com/radiantearth/stac-spec/tree/v1.1.0)\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Documentation](#documentation)\n- [Requirements](#requirements)\n- [Installation](#install)\n- [Supported STAC Versions](#versions-supported)\n- [Usage](#usage)\n  - [CLI](#cli)\n  - [Python](#python)\n- [Examples](#additional-examples)\n  - [Core Validation](#--core)\n  - [Custom Schema](#--custom)\n  - [Extensions Validation](#--extensions)\n  - [Recursive Validation](#--recursive)\n  - [Item Collection Validation](#--item-collection)\n  - [Using Headers](#--header)\n  - [Schema Mapping](#--schema-map)\n  - [Schema Config](#--schema-config)\n  - [Pydantic Validation](#--pydantic)\n- [Deployment](#deployment)\n  - [Docker](#docker)\n  - [AWS (CDK)](#aws-cdk)\n- [Testing](#testing)\n- [Related Projects](#related-projects)\n- [Sponsors and Supporters](#sponsors-and-supporters)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Overview\n\nSTAC Validator is a tool to validate [STAC (SpatioTemporal Asset Catalog)](https://github.com/radiantearth/stac-spec) json files against the official STAC specification. It provides both a command-line interface and a Python API for validating STAC objects.\n\n## Documentation\n\nFor detailed documentation, please visit our [GitHub Pages documentation site](https://stac-utils.github.io/stac-validator/).\n\n## Validate STAC json files against the [STAC spec](https://github.com/radiantearth/stac-spec).\n\n```bash\n$ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json\n```\n\n```bash\n[\n    {\n        \"version\": \"1.0.0\",\n        \"path\": \"https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json\",\n        \"schema\": [\n            \"https://stac-extensions.github.io/eo/v1.0.0/schema.json\",\n            \"https://stac-extensions.github.io/projection/v1.0.0/schema.json\",\n            \"https://stac-extensions.github.io/scientific/v1.0.0/schema.json\",\n            \"https://stac-extensions.github.io/view/v1.0.0/schema.json\",\n            \"https://stac-extensions.github.io/remote-data/v1.0.0/schema.json\",\n            \"https://schemas.stacspec.org/v1.0.0/item-spec/json-schema/item.json\"\n        ],\n        \"valid_stac\": true,\n        \"asset_type\": \"ITEM\",\n        \"validation_method\": \"default\"\n    }\n]\n```\n\n## Requirements\n\n- Python 3.8+\n  - Requests\n  - Click\n  - Jsonschema\n\n## Related Projects\n\nNote: Stac-validator is also used in stac-check which adds linting messages based on the official STAC best practices document.  \nhttps://github.com/stac-utils/stac-check\n\n## Install\n\n### Installation from PyPi\n\n```bash\n$ pip install stac-validator\n```\n\n### Installation from Repo\n\n```bash\n$ pip install .\n```\n\nor for local development\n\n```bash\n$ pip install -e '.[dev]'\n```\n\nThe [Makefile](./Makefile) has convenience commands if Make is installed.\n\n```bash\n$ make help\n```\n\n## Versions supported\n\n| STAC         |\n| ------------ |\n| 0.8.0        |\n| 0.8.1        |\n| 0.9.0        |\n| 1.0.0-beta.1 |\n| 1.0.0-beta.2 |\n| 1.0.0-rc.1   |\n| 1.0.0-rc.2   |\n| 1.0.0-rc.3   |\n| 1.0.0-rc.4   |\n| 1.0.0        |\n| 1.1.0-beta.1 |\n| 1.1.0        |\n\n## Usage\n\n### CLI\n\n**Basic Usage**\n\n```bash\n$ stac-validator --help\n```\n\n```bash\nUsage: stac-validator [OPTIONS] STAC_FILE\n\nOptions:\n  --core                          Validate core stac object only without\n                                  extensions.\n  --extensions                    Validate extensions only.\n  --links                         Additionally validate links. Only works with\n                                  default mode.\n  --assets                        Additionally validate assets. Only works\n                                  with default mode.\n  -c, --custom TEXT               Validate against a custom schema (local\n                                  filepath or remote schema).\n  -s, --schema-map \u003cTEXT TEXT\u003e...\n                                  Schema path to replaced by (local) schema\n                                  path during validation. Can be used multiple\n                                  times.\n  -r, --recursive                 Recursively validate all related stac\n                                  objects.\n  -m, --max-depth INTEGER         Maximum depth to traverse when recursing.\n                                  Omit this argument to get full recursion.\n                                  Ignored if `recursive == False`.\n  --collections                   Validate /collections response.\n  --item-collection               Validate item collection response. Can be\n                                  combined with --pages. Defaults to one page.\n  --no-assets-urls                Disables the opening of href links when\n                                  validating assets (enabled by default).\n  --header \u003cTEXT TEXT\u003e...         HTTP header to include in the requests. Can\n                                  be used multiple times.\n  -p, --pages INTEGER             Maximum number of pages to validate via\n                                  --item-collection. Defaults to one page.\n  -t, --trace-recursion           Enables verbose output for recursive mode.\n  --no_output                     Do not print output to console.\n  --log_file TEXT                 Save full recursive output to log file\n                                  (local filepath).\n  --pydantic                      Validate using stac-pydantic models for enhanced\n                                  type checking and validation.\n  --schema-config TEXT            Path to a YAML or JSON schema config file.\n  --verbose                       Enable verbose output. This will output\n                                  additional information during validation.\n  --help                          Show this message and exit.\n```\n\n### Python\n\n**Remote source**\n\n```python\nfrom stac_validator import stac_validator\n\nstac = stac_validator.StacValidate(\"https://raw.githubusercontent.com/stac-utils/pystac/main/tests/data-files/examples/0.9.0/collection-spec/examples/landsat-collection.json\")\nstac.run()\nprint(stac.message)\n```\n```python\n[\n    {\n        \"version\": \"0.9.0\",\n        \"path\": \"https://raw.githubusercontent.com/stac-utils/pystac/main/tests/data-files/examples/0.9.0/collection-spec/examples/landsat-collection.json\",\n        \"schema\": [\n            \"https://cdn.staclint.com/v0.9.0/collection.json\"\n        ],\n        \"valid_stac\": true,\n        \"asset_type\": \"COLLECTION\",\n        \"validation_method\": \"default\"\n    }\n]\n```\n\n**Local file**\n\n```python\nfrom stac_validator import stac_validator\n\nstac = stac_validator.StacValidate(\"tests/test_data/1beta1/sentinel2.json\", extensions=True)\nstac.run()\nprint(stac.message)\n```\n```python\n[\n    {\n        \"version\": \"1.0.0-beta.1\",\n        \"path\": \"tests/test_data/1beta1/sentinel2.json\",\n        \"schema\": [\n            \"https://cdn.staclint.com/v1.0.0-beta.1/collection.json\"\n        ],\n        \"valid_stac\": true,\n        \"asset_type\": \"COLLECTION\",\n        \"validation_method\": \"extensions\"\n    }\n]\n```\n\n**Dictionary**\n\n```python\nfrom stac_validator import stac_validator\n\nstac = stac_validator.StacValidate()\nstac.validate_dict(dictionary)\nprint(stac.message)\n```\n\n**Item Collection**\n\n```python\nfrom stac_validator import stac_validator\n\nstac = stac_validator.StacValidate()\nstac.validate_item_collection_dict(item_collection_dict)\nprint(stac.message)\n```\n\n## Deployment\n\n### Docker\n\nThe validator can run using docker containers.\n\n```bash\n$ docker build -t stac-validator .\n$ docker run stac-validator https://raw.githubusercontent.com/stac-extensions/projection/main/examples/item.json\n```\n\n```bash\n[\n    {\n        \"version\": \"1.0.0\",\n        \"path\": \"https://raw.githubusercontent.com/stac-extensions/projection/main/examples/item.json\",\n        \"schema\": [\n            \"https://stac-extensions.github.io/projection/v1.0.0/schema.json\",\n            \"https://schemas.stacspec.org/v1.0.0/item-spec/json-schema/item.json\"\n        ],\n        \"valid_stac\": true,\n        \"asset_type\": \"ITEM\",\n        \"validation_method\": \"default\"\n    }\n]\n```\n\n### AWS (CDK)\n\nAn example [AWS CDK](https://aws.amazon.com/cdk/) deployment is available in [cdk-deployment](./cdk-deployment/README.md)\n\n```bash\n$ cd cdk-deployment\n$ cdk diff\n```\n\n## Testing\n\n```bash\n$ make test\n# or\n$ pytest -v\n```\n\nSee the [tests](./tests/test_stac_validator.py) files for examples on different usages.\n\n## Additional Examples\n\n### --core\n\n```bash\n$ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json --core\n```\n\n```bash\n[\n    {\n        \"version\": \"1.0.0\",\n        \"path\": \"https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json\",\n        \"schema\": [\n            \"https://schemas.stacspec.org/v1.0.0/item-spec/json-schema/item.json\"\n        ],\n        \"valid_stac\": true,\n        \"asset_type\": \"ITEM\",\n        \"validation_method\": \"core\"\n    }\n]\n```\n\n### --custom\n\n```bash\n$ stac-validator https://radarstac.s3.amazonaws.com/stac/catalog.json --custom https://cdn.staclint.com/v0.7.0/catalog.json\n```\n\n```bash\n[\n    {\n        \"version\": \"0.7.0\",\n        \"path\": \"https://radarstac.s3.amazonaws.com/stac/catalog.json\",\n        \"schema\": [\n            \"https://cdn.staclint.com/v0.7.0/catalog.json\"\n        ],\n        \"asset_type\": \"CATALOG\",\n        \"validation_method\": \"custom\",\n        \"valid_stac\": true\n    }\n]\n```\n\n### --extensions\n\n```bash\n$ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json --extensions\n```\n\n```bash\n[\n    {\n        \"version\": \"1.0.0\",\n        \"path\": \"https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json\",\n        \"schema\": [\n            \"https://stac-extensions.github.io/eo/v1.0.0/schema.json\",\n            \"https://stac-extensions.github.io/projection/v1.0.0/schema.json\",\n            \"https://stac-extensions.github.io/scientific/v1.0.0/schema.json\",\n            \"https://stac-extensions.github.io/view/v1.0.0/schema.json\",\n            \"https://stac-extensions.github.io/remote-data/v1.0.0/schema.json\"\n        ],\n        \"valid_stac\": true,\n        \"asset_type\": \"ITEM\",\n        \"validation_method\": \"extensions\"\n    }\n]\n```\n\n### --recursive\n\n```bash\n$ stac-validator https://spot-canada-ortho.s3.amazonaws.com/catalog.json --recursive --max-depth 1 --trace-recursion\n```\n\n```bash\n[\n    {\n        \"version\": \"0.8.1\",\n        \"path\": \"https://canada-spot-ortho.s3.amazonaws.com/canada_spot_orthoimages/canada_spot4_orthoimages/collection.json\",\n        \"schema\": \"https://cdn.staclint.com/v0.8.1/collection.json\",\n        \"asset_type\": \"COLLECTION\",\n        \"validation_method\": \"recursive\",\n        \"valid_stac\": true\n    },\n    {\n        \"version\": \"0.8.1\",\n        \"path\": \"https://canada-spot-ortho.s3.amazonaws.com/canada_spot_orthoimages/canada_spot5_orthoimages/collection.json\",\n        \"schema\": \"https://cdn.staclint.com/v0.8.1/collection.json\",\n        \"asset_type\": \"COLLECTION\",\n        \"validation_method\": \"recursive\",\n        \"valid_stac\": true\n    },\n    {\n        \"version\": \"0.8.1\",\n        \"path\": \"https://spot-canada-ortho.s3.amazonaws.com/catalog.json\",\n        \"schema\": \"https://cdn.staclint.com/v0.8.1/catalog.json\",\n        \"asset_type\": \"CATALOG\",\n        \"validation_method\": \"recursive\",\n        \"valid_stac\": true\n    }\n]\n```\n\n### --item-collection\n\n```bash\n$ stac-validator https://earth-search.aws.element84.com/v0/collections/sentinel-s2-l2a/items --item-collection --pages 2\n```\n\n### --header\n\n```bash\n$ stac-validator https://stac-catalog.eu/collections/sentinel-s2-l2a/items --header x-api-key $MY_API_KEY --header foo bar\n```\n\n### --schema-map\n\nSchema map allows stac-validator to replace a schema in a STAC json by a schema from another URL or local schema file.\nThis is especially useful when developing a schema and testing validation against your local copy of the schema.\n\n```bash\n$ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/v1.0.0/examples/extended-item.json --extensions --schema-map https://stac-extensions.github.io/projection/v1.0.0/schema.json \"tests/test_data/schema/v1.0.0/projection.json\"\n```\n\n```bash\n[\n    {\n        \"version\": \"1.0.0\",\n        \"path\": \"https://raw.githubusercontent.com/radiantearth/stac-spec/v1.0.0/examples/extended-item.json\",\n        \"schema\": [\n            \"https://stac-extensions.github.io/eo/v1.0.0/schema.json\",\n            \"tests/test_data/schema/v1.0.0/projection.json\",\n            \"https://stac-extensions.github.io/scientific/v1.0.0/schema.json\",\n            \"https://stac-extensions.github.io/view/v1.0.0/schema.json\",\n            \"https://stac-extensions.github.io/remote-data/v1.0.0/schema.json\"\n        ],\n        \"valid_stac\": true,\n        \"asset_type\": \"ITEM\",\n        \"validation_method\": \"extensions\"\n    }\n]\n```\n\nThis option is also capable of replacing URLs to subschemas:\n\n```bash\n$ stac-validator tests/test_data/v100/extended-item-local.json --custom tests/test_data/schema/v1.0.0/item_with_unreachable_url.json --schema-map https://geojson-wrong-url.org/schema/Feature.json https://geojson.org/schema/Feature.json --schema-map https://geojson-wrong-url.org/schema/Geometry.json https://geojson.org/schema/Geometry.json\n```\n\n```bash\n[\n    {\n        \"version\": \"1.0.0\",\n        \"path\": \"tests/test_data/v100/extended-item-local.json\",\n        \"schema\": [\n            \"tests/test_data/schema/v1.0.0/item_with_unreachable_url.json\"\n        ],\n        \"valid_stac\": true,\n        \"asset_type\": \"ITEM\",\n        \"validation_method\": \"custom\"\n    }\n]\n```\n\n### --schema-config\n\nThe `--schema-config` option allows you to specify a YAML or JSON configuration file that maps remote schema URLs to local file paths. This is useful when you need to validate against multiple local schemas and want to avoid using multiple `--schema-map` arguments.\n\nExample schema config file (YAML):\n```yaml\nschemas:\n  \"https://schemas.stacspec.org/v1.0.0/collection-spec/json-schema/collection.json\": \"local_schemas/v1.0.0/collection.json\"\n  \"https://schemas.stacspec.org/v1.0.0/item-spec/json-schema/item.json\": \"local_schemas/v1.0.0/item.json\"\n  \"https://stac-extensions.github.io/eo/v1.0.0/schema.json\": \"local_schemas/v1.0.0/eo.json\"\n```\n\nUsage:\n```bash\n$ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/v1.0.0/examples/extended-item.json --schema-config path/to/schema_config.yaml\n```\n\nThe paths in the config file can be absolute or relative to the config file's location.\n\n### --pydantic\n\nThe `--pydantic` option provides enhanced validation using stac-pydantic models, which offer stronger type checking and more detailed error messages. To use this feature, you need to install the optional dependency:\n\n```bash\n$ pip install stac-validator[pydantic]\n```\n\nThen you can validate your STAC objects using Pydantic models:\n\n```bash\n$ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json --pydantic\n```\n\n```bash\n[\n    {\n        \"version\": \"1.0.0\",\n        \"path\": \"https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json\",\n        \"schema\": [\n            \"stac-pydantic Item model\"\n        ],\n        \"valid_stac\": true,\n        \"asset_type\": \"ITEM\",\n        \"validation_method\": \"pydantic\",\n        \"extension_schemas\": [\n            \"https://stac-extensions.github.io/eo/v1.0.0/schema.json\",\n            \"https://stac-extensions.github.io/projection/v1.0.0/schema.json\",\n            \"https://stac-extensions.github.io/scientific/v1.0.0/schema.json\",\n            \"https://stac-extensions.github.io/view/v1.0.0/schema.json\",\n            \"https://stac-extensions.github.io/remote-data/v1.0.0/schema.json\"\n        ],\n        \"model_validation\": \"passed\"\n    }\n]\n```\n\n## Sponsors and Supporters\n\nThe following organizations have contributed time and/or funding to support the development of this project:\n- [Healy Hyperspatial](https://healy-hyperspatial.github.io/)\n- [Radiant Earth Foundation](https://radiant.earth/)\n- [Sparkgeo](https://sparkgeo.com/)\n\n\u003cp align=\"left\"\u003e\n  \u003ca href=\"https://healy-hyperspatial.github.io/\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/stac-utils/stac-fastapi-elasticsearch-opensearch/refs/heads/main/assets/hh-logo-blue.png\" alt=\"Healy Hyperspatial\" height=\"100\" hspace=\"20\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://radiant.earth/\"\u003e\u003cimg src=\"assets/radiant-earth.webp\" alt=\"Radiant Earth Foundation\" height=\"100\" hspace=\"20\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://sparkgeo.com/\"\u003e\u003cimg src=\"assets/sparkgeo_logo.jpeg\" alt=\"Sparkgeo\" height=\"100\" hspace=\"20\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the Apache License 2.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstac-utils%2Fstac-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstac-utils%2Fstac-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstac-utils%2Fstac-validator/lists"}