diff --git a/CHANGELOG.md b/CHANGELOG.md index 694cc16d..ee583e9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added + - [628](https://github.com/thoth-pub/thoth/pull/628) - Implement OpenAPI v3 schema in export API, served under `/openapi.json` + - [628](https://github.com/thoth-pub/thoth/pull/628) - Added terms of service to export API + ### Changed - [551](https://github.com/thoth-pub/thoth/issues/551) - Only include chapters in Crossref metadata output if they have DOIs + - [628](https://github.com/thoth-pub/thoth/pull/628) - Upgrade `paperclip` to v0.9.1 + - [628](https://github.com/thoth-pub/thoth/pull/628) - Upgrade rust to `1.81.0` in production and development `Dockerfile` ### Fixed - [565](https://github.com/thoth-pub/thoth/issues/565) - Don't generate Crossref metadata output if no DOIs (work or chapter) are present diff --git a/Cargo.lock b/Cargo.lock index 795a3899..b6bf32a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1697,6 +1697,7 @@ checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown 0.12.3", + "serde", ] [[package]] @@ -2053,6 +2054,17 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" +[[package]] +name = "openapiv3" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33b83630305ecc3355e998ddd2f926f98aae8e105eb42652174a58757851ba47" +dependencies = [ + "indexmap 1.9.3", + "serde", + "serde_json", +] + [[package]] name = "openssl" version = "0.10.66" @@ -2099,13 +2111,14 @@ dependencies = [ [[package]] name = "paperclip" -version = "0.8.2" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2509afd8f138efe07cd367832289f5cc61d1eb1ec7f1eb75172abca6f7b9b66d" +checksum = "ac41f27e83168c22515ef52d62a0357b5f5b8df846aa391f8b903b0ed7719429" dependencies = [ "anyhow", "itertools", "once_cell", + "openapiv3", "paperclip-actix", "paperclip-core", "paperclip-macros", @@ -2120,15 +2133,16 @@ dependencies = [ [[package]] name = "paperclip-actix" -version = "0.6.2" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4adf797da91baee514bc03b020fdd6673d2f8c1af8a859e50d6d803a4b3dddd2" +checksum = "d5b6f4c003aa6167df82f1574c951638a8b9a43827059da0cda8b5df88d20ecf" dependencies = [ "actix-service", "actix-web", "futures", "mime_guess", "once_cell", + "openapiv3", "paperclip-core", "paperclip-macros", "serde_json", @@ -2136,13 +2150,14 @@ dependencies = [ [[package]] name = "paperclip-core" -version = "0.6.2" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8db363c823fa71c00da73ff8cee3d6902e1ad66b770cc224a74dc7cf54de3aad" +checksum = "8e2e742f71daf34eb8f62ccc5a1a5e1f029eb84be563523a2a5ee049366329f4" dependencies = [ "actix-web", "mime", "once_cell", + "openapiv3", "paperclip-macros", "pin-project-lite", "regex", @@ -2155,9 +2170,9 @@ dependencies = [ [[package]] name = "paperclip-macros" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6e25ce2c5362c8d48dc89e0f9ca076d507f7c1eabd04f0d593cdf5addff90c" +checksum = "0385be5ae9c886c46688290534363a229f2531aa2c5c2bfc3b3ddafed5143aaa" dependencies = [ "heck 0.4.1", "http", diff --git a/Dockerfile b/Dockerfile index 16bf4592..3d87552c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG MUSL_IMAGE=clux/muslrust:1.80.1-stable +ARG MUSL_IMAGE=clux/muslrust:1.81.0-stable FROM ${MUSL_IMAGE} as build diff --git a/Dockerfile.dev b/Dockerfile.dev index a9035611..e3ff5cf2 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,4 +1,4 @@ -ARG RUST_VERSION=1.80.1 +ARG RUST_VERSION=1.81.0 FROM rust:${RUST_VERSION} diff --git a/thoth-export-server/Cargo.toml b/thoth-export-server/Cargo.toml index f3607cd7..83395ec9 100644 --- a/thoth-export-server/Cargo.toml +++ b/thoth-export-server/Cargo.toml @@ -23,7 +23,7 @@ futures = "0.3.30" lazy_static = "1.5.0" log = "0.4.20" marc = { version = "3.1.1", features = ["xml"] } -paperclip = { version = "0.8.2", features = ["actix-base", "actix4", "uuid1", "v2"] } +paperclip = { version = "0.9.1", features = ["actix4", "uuid1", "v3"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" uuid = { version = "1.10.0", features = ["serde"] } diff --git a/thoth-export-server/src/lib.rs b/thoth-export-server/src/lib.rs index 7b85b470..7ac5ca87 100644 --- a/thoth-export-server/src/lib.rs +++ b/thoth-export-server/src/lib.rs @@ -31,7 +31,7 @@ struct ApiConfig { impl ApiConfig { pub fn new(public_url: String) -> Self { Self { - api_schema: format!("{public_url}/swagger.json"), + api_schema: format!("{public_url}/openapi.json"), } } } @@ -82,6 +82,7 @@ pub async fn start_server( "Obtain Thoth metadata records in various formats and platform specifications" .to_string(), ), + terms_of_service: Some("https://thoth.pub/policies/terms-thoth-free".to_string()), contact: Some(Contact { name: Some("Thoth Support".to_string()), url: Some("https://thoth.pub".to_string()), @@ -107,6 +108,7 @@ pub async fn start_server( .configure(platform::route) .configure(specification::route) .with_json_spec_at("/swagger.json") + .with_json_spec_v3_at("/openapi.json") .build() }) .workers(threads)