mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
Fix build break (#634)
* fix: update bindings and builtins for breaking dependency upgrades - Update rand 0.10 API: use RngExt trait instead of removed Rng trait - Update jsonschema 0.45 API: replace removed BasicOutput/apply with iter_errors for schema validation - Update jni 0.22 API: migrate from deprecated JNIEnv to EnvUnowned with_env pattern, replace deprecated get_string/new_string/throw methods with their modern equivalents - Update pyo3 0.28 API: replace removed PyObject with Py<PyAny>, deprecated downcast with cast, and removed with_gil with attach Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com> * ci(dependabot): create per-dependency PRs for Cargo updates Remove the groups.rust-dependencies catch-all group so Dependabot opens a separate PR for each Cargo dependency update instead of bundling them all into a single PR. Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com> * fix: enable getrandom wasm_js feature for wasm32-unknown-unknown builds Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com> * fix: address PR review comments - Stream iter_errors directly into BTreeSet without intermediate Vec - Use JNI_TRUE/JNI_FALSE for jboolean instead of bool coercion Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com> --------- Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
committed by
GitHub
parent
296b34171a
commit
35fb5d5953
+6
-7
@@ -38,13 +38,12 @@ pub fn validate_schema(schema: &serde_json::Value) -> bool {
|
||||
/// Validates a schema definition against the Regorus meta-schema.
|
||||
/// Returns Ok(()) if valid, or Err with validation errors if invalid.
|
||||
pub fn validate_schema_detailed(schema: &serde_json::Value) -> Result<(), Vec<String>> {
|
||||
if let jsonschema::BasicOutput::Invalid(errors) = META_SCHEMA_VALIDATOR.apply(schema).basic() {
|
||||
let msgs: alloc::collections::BTreeSet<String> = errors
|
||||
.iter()
|
||||
.map(|e| format!("{}: {}", e.instance_location(), e.error_description()))
|
||||
.collect();
|
||||
let msgs: Vec<String> = msgs.into_iter().collect();
|
||||
return Err(msgs);
|
||||
let msgs: alloc::collections::BTreeSet<String> = META_SCHEMA_VALIDATOR
|
||||
.iter_errors(schema)
|
||||
.map(|e| format!("{}: {}", e.instance_path(), e))
|
||||
.collect();
|
||||
if !msgs.is_empty() {
|
||||
return Err(msgs.into_iter().collect());
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user