File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -510,10 +510,11 @@ impl Engine {
510510 /// engine.enable_type_checking();
511511 ///
512512 /// // Set input schema
513+ /// # #[cfg(feature = "jsonschema")]
513514 /// if let Some(checker) = engine.get_type_checker_mut() {
514515 /// let schema = Schema::from_json_str(
515516 /// r#"{"type": "object", "properties": {"value": {"type": "integer"}}}"#
516- /// )?;
517+ /// ).map_err(|e| anyhow::anyhow!("{e}")) ?;
517518 /// checker.set_input_schema(schema);
518519 /// }
519520 ///
Original file line number Diff line number Diff line change @@ -214,6 +214,7 @@ pub mod validate;
214214/// Schemas are typically created by deserializing from JSON Schema format:
215215///
216216/// ```rust
217+ /// use regorus::schema::Schema;
217218/// use serde_json::json;
218219///
219220/// // Create a schema from JSON
@@ -253,12 +254,16 @@ pub mod validate;
253254///
254255/// ## Simple String Schema
255256/// ```rust
257+ /// # use regorus::schema::Schema;
258+ /// # use serde_json::json;
256259/// let schema = json!({ "type": "string", "minLength": 1 });
257260/// let parsed: Schema = serde_json::from_value(schema).unwrap();
258261/// ```
259262///
260263/// ## Complex Object Schema
261264/// ```rust
265+ /// # use regorus::schema::Schema;
266+ /// # use serde_json::json;
262267/// let schema = json!({
263268/// "type": "object",
264269/// "properties": {
@@ -280,6 +285,8 @@ pub mod validate;
280285///
281286/// ## Union Types with anyOf
282287/// ```rust
288+ /// # use regorus::schema::Schema;
289+ /// # use serde_json::json;
283290/// let schema = json!({
284291/// "anyOf": [
285292/// { "type": "string" },
You can’t perform that action at this time.
0 commit comments