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
921 changes: 667 additions & 254 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion backend/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tokio = { version = "1", features = ["full"] }
axum = { version = "0.8.8", features = ["macros"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
schemars = "0.8"
schemars = "1.2"
uuid = { version = "1.22.0", features = ["v4", "serde"] }
rand = "0.10.0"
dashmap = "6.1.0"
Expand Down
4 changes: 2 additions & 2 deletions backend/api/src/api/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use axum::{
http::StatusCode,
response::{IntoResponse, Json, Response},
};
use schemars::schema::RootSchema;
use schemars::Schema;
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use solver_contracts::{
bootstrap::bootstrap_spec,
Expand Down Expand Up @@ -175,7 +175,7 @@ pub async fn schema_list_handler() -> Json<Vec<SchemaSummary>> {
)
}

pub async fn schema_get_handler(Path(schema_id): Path<String>) -> Result<Json<RootSchema>, ApiError> {
pub async fn schema_get_handler(Path(schema_id): Path<String>) -> Result<Json<Schema>, ApiError> {
export_schema(&schema_id)
.map(Json)
.ok_or_else(|| unknown_schema_api_error(&schema_id))
Expand Down
2 changes: 1 addition & 1 deletion backend/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ serde_json = "1.0"
anyhow = "1.0"

[dev-dependencies]
tempfile = "3.14"
tempfile = "3.27"
6 changes: 3 additions & 3 deletions backend/contracts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ name = "solver_contracts"
path = "src/lib.rs"

[dependencies]
schemars = "0.8"
schemars = "1.2"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
solver-core = { path = "../core" }

[dev-dependencies]
jsonschema = "0.29"
tempfile = "3.14"
jsonschema = "0.45"
tempfile = "3.27"
28 changes: 14 additions & 14 deletions backend/contracts/src/schemas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::types::{
RecommendSettingsRequest, ResultSummary, SchemaId, SolveRequest, SolveResponse,
SolverConfigurationContract, ValidateRequest, ValidateResponse,
};
use schemars::{schema::RootSchema, schema_for};
use schemars::{schema_for, Schema};

pub const SCHEMA_VERSION_V1: &str = "v1";

Expand All @@ -22,7 +22,7 @@ pub const PUBLIC_ERROR_ENVELOPE_SCHEMA_ID: &str = "public-error-envelope";
pub struct SchemaSpec {
pub id: SchemaId,
pub version: &'static str,
pub export: fn() -> RootSchema,
pub export: fn() -> Schema,
}

const SCHEMA_SPECS: &[SchemaSpec] = &[
Expand Down Expand Up @@ -86,47 +86,47 @@ pub fn schema_spec(id: &str) -> Option<&'static SchemaSpec> {
SCHEMA_SPECS.iter().find(|spec| spec.id == id)
}

pub fn export_schema(id: &str) -> Option<RootSchema> {
pub fn export_schema(id: &str) -> Option<Schema> {
schema_spec(id).map(|spec| (spec.export)())
}

fn export_solve_request_schema() -> RootSchema {
fn export_solve_request_schema() -> Schema {
schema_for!(SolveRequest)
}

fn export_solve_response_schema() -> RootSchema {
fn export_solve_response_schema() -> Schema {
schema_for!(SolveResponse)
}

fn export_validate_request_schema() -> RootSchema {
fn export_validate_request_schema() -> Schema {
schema_for!(ValidateRequest)
}

fn export_validate_response_schema() -> RootSchema {
fn export_validate_response_schema() -> Schema {
schema_for!(ValidateResponse)
}

fn export_problem_definition_schema() -> RootSchema {
fn export_problem_definition_schema() -> Schema {
schema_for!(ProblemDefinitionContract)
}

fn export_recommend_settings_request_schema() -> RootSchema {
fn export_recommend_settings_request_schema() -> Schema {
schema_for!(RecommendSettingsRequest)
}

fn export_solver_configuration_schema() -> RootSchema {
fn export_solver_configuration_schema() -> Schema {
schema_for!(SolverConfigurationContract)
}

fn export_progress_update_schema() -> RootSchema {
fn export_progress_update_schema() -> Schema {
schema_for!(ProgressUpdateContract)
}

fn export_result_summary_schema() -> RootSchema {
fn export_result_summary_schema() -> Schema {
schema_for!(ResultSummary)
}

fn export_public_error_envelope_schema() -> RootSchema {
fn export_public_error_envelope_schema() -> Schema {
schema_for!(PublicErrorEnvelope)
}

Expand All @@ -145,7 +145,7 @@ mod tests {
fn registered_schema_exports_succeed() {
for spec in schema_specs() {
let exported = export_schema(spec.id).expect("schema registered");
assert!(exported.schema.object.is_some() || exported.schema.subschemas.is_some());
assert!(exported.as_object().is_some() || exported.as_bool().is_some());
}
}
}
2 changes: 1 addition & 1 deletion backend/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ path = "src/lib.rs"

[dependencies]
serde = { version = "1.0.190", features = ["derive"] }
schemars = "0.8"
schemars = "1.2"
rand = { version = "0.10.0", features = ["std_rng"] }
rand_chacha = "0.10.0"
uuid = { version = "1.22.0", features = ["v4", "serde", "js"] }
Expand Down
2 changes: 1 addition & 1 deletion backend/wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ wasm-bindgen-futures = "0.4"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde-wasm-bindgen = "0.6"
schemars = "0.8"
schemars = "1.2"
js-sys = "0.3"
web-sys = { version = "0.3", features = ["console", "Performance", "Window"] }
getrandom = { version = "0.4", features = ["wasm_js"] }
Expand Down
6 changes: 3 additions & 3 deletions backend/wasm/src/contract_projection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::public_errors::{
internal_error, public_error_to_js_value, unknown_error_code_error, unknown_operation_error,
unknown_schema_error,
};
use schemars::schema::RootSchema;
use schemars::Schema;
use serde::Serialize;
use solver_contracts::{
bootstrap::{bootstrap_spec, BootstrapSpec},
Expand Down Expand Up @@ -75,7 +75,7 @@ pub struct WasmSchemaSummary {
pub struct WasmSchemaLookupResponse {
pub id: &'static str,
pub version: &'static str,
pub schema: RootSchema,
pub schema: Schema,
}

#[derive(Debug, Clone, Serialize)]
Expand Down Expand Up @@ -293,7 +293,7 @@ mod tests {

let solve_schema = build_schema_lookup_response("solve-request").expect("solve-request schema");
assert_eq!(solve_schema.id, "solve-request");
assert!(solve_schema.schema.schema.object.is_some() || solve_schema.schema.schema.subschemas.is_some());
assert!(solve_schema.schema.as_object().is_some() || solve_schema.schema.as_bool().is_some());
}

#[test]
Expand Down
6 changes: 3 additions & 3 deletions solver-benchmarking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ path = "src/lib.rs"
[dependencies]
anyhow = "1.0"
chrono = { version = "0.4", features = ["clock", "serde"] }
rusqlite = { version = "0.33", features = ["bundled"] }
rusqlite = { version = "0.39", features = ["bundled"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_yaml = "0.9"
sha2 = "0.10"
sha2 = "0.11"
solver-core = { path = "../backend/core" }
uuid = { version = "1.22.0", features = ["v4"] }

[dev-dependencies]
tempfile = "3.14"
tempfile = "3.27"
2 changes: 1 addition & 1 deletion solver-benchmarking/src/recordings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ fn sha256_file(path: &Path) -> Result<String> {
let contents = fs::read(path)
.with_context(|| format!("failed to read suite manifest for hashing {}", path.display()))?;
let digest = Sha256::digest(contents);
Ok(format!("{:x}", digest))
Ok(digest.iter().map(|byte| format!("{byte:02x}")).collect())
}

fn relative_or_display(root: &Path, path: &Path) -> String {
Expand Down
Loading
Loading