Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion catalog-spec/json-schema/catalog.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "catalog.json#",
"definitions": {
"link": {
Expand Down
2 changes: 1 addition & 1 deletion collection-spec/json-schema/collection.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "collection.json#",
"title": "STAC Collection Specification",
"description": "This object represents Collections in a SpatioTemporal Asset Catalog.",
Expand Down
2 changes: 1 addition & 1 deletion extensions/checksum/schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "schema.json#",
"type": "object",
"title": "Checksum Extension Specification",
Expand Down
3 changes: 2 additions & 1 deletion extensions/datacube/schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "schema.json#",
"title": "Data Cube Extension",
"type": "object",
"description": "STAC Data Cube Extension",
Expand Down
2 changes: 1 addition & 1 deletion extensions/datetime-range/schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "schema.json#",
"type": "object",
"title": "STAC Datetime Range Extension Spec",
Expand Down
2 changes: 1 addition & 1 deletion extensions/eo/schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "stac-eo-extension.json#",
"title": "EO Extension",
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion extensions/sar/schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "schema.json#",
"title": "SAR Extension",
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion extensions/scientific/schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "schema.json#",
"type": "object",
"title": "STAC Scientific Extension Spec",
Expand Down
2 changes: 1 addition & 1 deletion extensions/single-item/schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "schema.json#",
"type": "object",
"title": "Single Item Extension",
Expand Down
4 changes: 2 additions & 2 deletions item-spec/json-schema/geojson.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"id": "geojson.json#",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "geojson.json#",
"title": "GeoJSON Object",
"type": "object",
"description":
Expand Down
2 changes: 1 addition & 1 deletion item-spec/json-schema/item.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "item.json#",
"title": "STAC Item",
"type": "object",
Expand Down
84 changes: 21 additions & 63 deletions validation/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
# STAC Schema Validation

Any JSON Schema validation tool can be used, just run the JSON data to test
against the various STAC schema, and be sure to include any remote schema
like the geojson.json schema in the testing.

Any JSON Schema validation tool can be used, just run the JSON data to test against the various STAC schema, and be sure to include any remote schema like the geojson.json schema in the testing.

This directory includes installation instructions for a Python validator and a JavaScript validator. The python validator is more complete and the recommnded tool for validation. The Javascript validator has been deprecated and will be removed in the next release.
This directory includes installation instructions for a Python validator and
a JavaScript validator. The python validator is more complete and the
recommnded tool for validation. The Javascript validator has been deprecated
and will be removed in the next release.

## Python Validator
Install the validator from the [stac-validator](https://github.com/sparkgeo/stac-validator) repository and follow the instructions.

The validator can be run as a command line tool and will report on nested catalogs as well as single items. There is no need to specifically identify
Install the validator from the
[stac-validator](https://github.com/sparkgeo/stac-validator) repository and
follow the instructions.

```
stac_validator.py --help
The validator can be run as a command line tool and will report on nested
catalogs as well as single items. There is no need to specifically identify
individual catalogs or items.

### Usage

```
Description: Validate a STAC item or catalog against the STAC specification.

Usage:
Expand All @@ -26,10 +35,12 @@ Options:
-h, --help Show this screen.
--verbose Verbose output. [default: False]
--timer Reports time to validate the STAC (seconds)
```

E.g.

stac_validator.py https://earth-stac.s3.amazonaws.com/eo/landsat-8-l1/catalog.json -v latest

```bash
$ stac_validator.py https://earth-stac.s3.amazonaws.com/eo/landsat-8-l1/catalog.json -v latest
{
"catalogs": {
"valid": 1,
Expand All @@ -44,57 +55,4 @@ stac_validator.py https://earth-stac.s3.amazonaws.com/eo/landsat-8-l1/catalog.js
"invalid": 0
}
}
```

## JavaScript Validator
### Initialization

In this directory run:

```bash
npm install
```

This installs node.js validation modules, in a node_modules directory created in this directory.

### Validation

In the following chapter there are commands to run a validation of any STAC against the JSON Schema.

**Warning:** Not all validation is fully complete. For items, the validator does not yet check for `self`
links. The `href` checking is probably too loose right now, it just checks for a string, see the
'relative vs absolute links' section in the [Item spec](../item-spec/item-spec.md#relative-vs-absolute-links) for reasons why.

### Catalogs

To run the validation for a catalog file:

```bash
npm run validate_catalog -- -d ../catalog-spec/examples/catalog.json
```

### Collections

To run the validation for a collection file:

```bash
npm run validate_collection -- -d ../collection-spec/examples/sentinel2.json
```

### Extensions

To run the validation for an extension:

```bash
npm run validate_extension -- -s ../extensions/scientific/schema.json -d ../extensions/scientific/example-merraclim.json
```

This example runs the validation for the scientific extension, please change the `-s` (schema file) and `-d` (data file) accordingly.

### Items

To run the validation for an item file:

```bash
npm run validate_item -- -d ../item-spec/examples/sample.json
```
```
Loading