Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move validate into core #434

Merged
merged 2 commits into from
Sep 23, 2024
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
4 changes: 0 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ updates:
directory: "/stac-server"
schedule:
interval: "weekly"
- package-ecosystem: "cargo"
directory: "/stac-validate"
schedule:
interval: "weekly"
- package-ecosystem: "pip"
directory: "/scripts"
schedule:
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,5 @@ jobs:
- uses: actions/checkout@v4
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- name: Check
run: cargo check
- name: Check w/ geo
run: cargo check -F geo
- name: Check w/ client
run: cargo check -F client
- name: Test
run: cargo test --all-features
23 changes: 20 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
sudo apt-get install libgdal-dev
- name: Test
run: cargo test --lib
check:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -37,10 +37,27 @@ jobs:
sudo apt-get install libgdal-dev
- name: Fmt
run: cargo fmt
- name: Check
run: cargo check --all --all-features
- name: Clippy
run: cargo clippy --all --all-features
check:
runs-on: ubuntu-latest
strategy:
matrix:
chunk:
- 1
- 2
- 3
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Install GDAL
run: |
sudo apt-get update
sudo apt-get install libgdal-dev
- name: Install check-all-features
run: cargo install cargo-all-features
- name: Check
run: cargo check-all-features --n-chunks 3 --chunk ${{ matrix.chunk }}
check-nightly:
runs-on: ubuntu-latest
steps:
Expand Down
14 changes: 1 addition & 13 deletions .github/workflows/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,17 @@ jobs:
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- name: Check w/ no default features
run: cargo check --no-default-features
- name: Check w/ pgstac
run: cargo check --no-default-features -F pgstac
- name: Check w/ python
run: cargo check --no-default-features -F python
- name: Test
run: cargo test --no-default-features -F pgstac -F python
test-cli-with-gdal:
runs-on: ubuntu-latest
strategy:
matrix:
args:
- "--no-default-features -F gdal"
- ""
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
Expand All @@ -59,7 +47,7 @@ jobs:
sudo apt-get update
sudo apt-get install libgdal-dev
- name: Test
run: cargo test ${{ matrix.args }}
run: cargo test --no-default-features -F gdal
test-cli-with-duckdb:
runs-on: ubuntu-latest
steps:
Expand Down
17 changes: 2 additions & 15 deletions .github/workflows/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,15 @@ jobs:
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- name: Check
run: cargo check
- name: Check w/ geo
run: cargo check -F geo
- name: Check w/ geoarrow
run: cargo check -F geoarrow
- name: Check w/ geoparquet
run: cargo check -F geoparquet
- name: Check w/ object-store
run: cargo check -F object-store
- name: Check w/ reqwest
run: cargo check -F reqwest
- name: Test
run: cargo test -F geo -F geoparquet-compression -F reqwest -F object-store-all
run: cargo test -F geo -F geoparquet-compression -F reqwest -F object-store-all -F validate-blocking
test-core-with-gdal:
runs-on: ubuntu-latest
steps:
Expand All @@ -59,4 +46,4 @@ jobs:
sudo apt-get update
sudo apt-get install libgdal-dev
- name: Test
run: cargo test -F gdal
run: cargo test --all-features
6 changes: 0 additions & 6 deletions .github/workflows/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,5 @@ jobs:
- uses: actions/checkout@v4
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- name: Check
run: cargo check
- name: Check
run: cargo check -F axum
- name: Check
run: cargo check -F pgstac
- name: Test
run: cargo test -F axum -F pgstac
40 changes: 0 additions & 40 deletions .github/workflows/validate.yml

This file was deleted.

13 changes: 2 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
[workspace]
resolver = "2"
members = [
"api",
"cli",
"core",
"duckdb",
"pgstac",
"python",
"server",
"validate",
]
default-members = ["api", "cli", "core", "server", "validate"]
members = ["api", "cli", "core", "duckdb", "pgstac", "python", "server"]
default-members = ["api", "cli", "core", "server"]
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ This monorepo contains several crates:
| [stac-api](./api/README.md) | Data structures for the [STAC API](https://github.com/radiantearth/stac-api-spec) specification | [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/stac-utils/stac-rs/api.yml?style=flat-square&branch=main)](https://github.com/stac-utils/stac-rs/actions/workflows/api.yml) <br /> [![docs.rs](https://img.shields.io/docsrs/stac-api?style=flat-square)](https://docs.rs/stac-api/latest/stac_api/) <br> [![Crates.io](https://img.shields.io/crates/v/stac-api?style=flat-square)](https://crates.io/crates/stac-api) |
| [stac-cli](./cli/README.md)| Command line interface | [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/stac-utils/stac-rs/cli.yml?style=flat-square&branch=main)](https://github.com/stac-utils/stac-rs/actions/workflows/cli.yml) <br /> [![docs.rs](https://img.shields.io/docsrs/stac-cli?style=flat-square)](https://docs.rs/stac-cli/latest/stac_cli/) <br> [![Crates.io](https://img.shields.io/crates/v/stac-cli?style=flat-square)](https://crates.io/crates/stac-cli) |
| [stac-server](./server/README.md)| STAC API server with multiple backends | [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/stac-utils/stac-rs/server.yml?style=flat-square&branch=main)](https://github.com/stac-utils/stac-rs/actions/workflows/server.yml) <br /> [![docs.rs](https://img.shields.io/docsrs/stac-server?style=flat-square)](https://docs.rs/stac-server/latest/stac_server/) <br> [![Crates.io](https://img.shields.io/crates/v/stac-server?style=flat-square)](https://crates.io/crates/stac-server) |
| [stac-validate](./validate/README.md) | Validate STAC data structures with [jsonschema](https://json-schema.org/) | [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/stac-utils/stac-rs/validate.yml?style=flat-square&branch-main)](https://github.com/stac-utils/stac-rs/actions/workflows/validate.yml) <br /> [![docs.rs](https://img.shields.io/docsrs/stac-validate?style=flat-square)](https://docs.rs/stac-validate/latest/stac-validate/) <br> [![Crates.io](https://img.shields.io/crates/v/stac-validate?style=flat-square)](https://crates.io/crates/stac-validate) |
| [pgstac](./pgstac/README.md) | Bindings for [pgstac](https://github.com/stac-utils/pgstac) | [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/stac-utils/stac-rs/pgstac.yml?style=flat-square&branch=main)](https://github.com/stac-utils/stac-rs/actions/workflows/pgstac.yml) <br /> [![docs.rs](https://img.shields.io/docsrs/pgstac?style=flat-square)](https://docs.rs/pgstac/latest/pgstac/) <br> [![Crates.io](https://img.shields.io/crates/v/pgstac?style=flat-square)](https://crates.io/crates/pgstac) |
| [stac-duckdb](./duckdb/README.md) | Experimental client for [duckdb](https://duckdb.org/) | [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/stac-utils/stac-rs/duckdb.yml?style=flat-square&branch=main)](https://github.com/stac-utils/stac-rs/actions/workflows/duckdb.yml) <br /> [![docs.rs](https://img.shields.io/docsrs/stac-duckdb?style=flat-square)](https://docs.rs/stac-duckdb/latest/stac_duckdb/) <br> [![Crates.io](https://img.shields.io/crates/v/stac-duckdb?style=flat-square)](https://crates.io/crates/stac-duckdb) |

Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ stac = { version = "0.10.0", path = "../core", features = [
"geoparquet-compression",
"object-store-all",
"reqwest",
"validate",
] }
stac-api = { version = "0.6.0", path = "../api", features = ["client"] }
stac-duckdb = { version = "0.0.2", path = "../duckdb", optional = true }
stac-server = { version = "0.3.1", path = "../server", features = ["axum"] }
stac-validate = { version = "0.3.0", path = "../validate" }
thiserror = "1"
tokio = { version = "1.23", features = [
"macros",
Expand Down
4 changes: 2 additions & 2 deletions cli/src/args/validate.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::{Input, Run};
use crate::{Error, Result, Value};
use stac_validate::Validate;
use stac::Validate;
use tokio::sync::mpsc::Sender;

/// Arguments for the `validate` subcommand.
Expand All @@ -17,7 +17,7 @@ impl Run for Args {
async fn run(self, input: Input, _: Option<Sender<Value>>) -> Result<Option<Value>> {
let value = input.get().await?;
let result = value.validate().await;
if let Err(stac_validate::Error::Validation(ref errors)) = result {
if let Err(stac::Error::Validation(ref errors)) = result {
let message_base = match value {
stac::Value::Item(item) => format!("[item={}] ", item.id),
stac::Value::Catalog(catalog) => format!("[catalog={}] ", catalog.id),
Expand Down
4 changes: 0 additions & 4 deletions cli/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ pub enum Error {
#[error(transparent)]
StacServer(#[from] stac_server::Error),

/// [stac_validate::Error]
#[error(transparent)]
StacValidate(#[from] stac_validate::Error),

/// [tokio::sync::mpsc::error::SendError]
#[error(transparent)]
TokioSend(#[from] tokio::sync::mpsc::error::SendError<Value>),
Expand Down
4 changes: 4 additions & 0 deletions core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

### Added

- Validation, from the (now defunct) **stac-validate** ([#434](https://github.com/stac-utils/stac-rs/pull/434))

## [0.10.1] - 2024-09-20

### Fixed
Expand Down
18 changes: 17 additions & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ object-store-all = [
"object-store-http",
]
reqwest = ["dep:reqwest"]
validate = ["dep:jsonschema", "dep:reqwest", "dep:tokio", "dep:tracing"]
validate-blocking = ["validate", "tokio/rt"]

[dependencies]
arrow-array = { version = "52", optional = true }
Expand All @@ -57,6 +59,7 @@ geo = { version = "0.28", optional = true }
geo-types = { version = "0.7", optional = true }
geoarrow = { version = "0.3", optional = true }
geojson = "0.24"
jsonschema = { version = "0.20", optional = true }
log = "0.4"
mime = "0.3"
object_store = { version = "0.11", optional = true }
Expand All @@ -65,16 +68,29 @@ reqwest = { version = "0.12", optional = true, features = ["json", "blocking"] }
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1", features = ["preserve_order"] }
thiserror = "1"
tracing = { version = "0.1", optional = true }
tokio = { version = "1", optional = true }
url = "2"

[dev-dependencies]
assert-json-diff = "2"
bytes = "1"
rstest = "0.22"
tempdir = "0.3"
tokio = "1"
tokio = { version = "1", features = ["macros"] }
tokio-test = "0.4"

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[package.metadata.cargo-all-features]
max_combination_size = 2
denylist = [
"geoparquet-compression",
"object-store-all",
"object-store-aws",
"object-store-azure",
"object-store-gcp",
"object-store-http",
]
Loading
Loading