Commit 767da4a 1 parent 5721eca commit 767da4a Copy full SHA for 767da4a
File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -468,6 +468,26 @@ impl TypeSpaceSettings {
468
468
/// Typical usage is to map a schema definition to a builtin type or type
469
469
/// provided by a crate, such as `'rust_decimal::Decimal'`. If the same schema
470
470
/// is specified multiple times, the first one is honored.
471
+ ///
472
+ /// # Examples
473
+ ///
474
+ /// ```
475
+ /// // Setup 'number' json type to be translated into 'rust_decimal::Decimal'
476
+ /// use schemars::schema::{InstanceType, SchemaObject};
477
+ /// use typify_impl::{TypeSpace, TypeSpaceImpl, TypeSpaceSettings};
478
+ /// let mut type_space = TypeSpace::new(
479
+ /// TypeSpaceSettings::default()
480
+ /// .with_struct_builder(true)
481
+ /// .with_conversion(
482
+ /// SchemaObject {
483
+ /// instance_type: Some(InstanceType::Number.into()),
484
+ /// ..Default::default()
485
+ /// },
486
+ /// "rust_decimal::Decimal",
487
+ /// [TypeSpaceImpl::Display].into_iter(),
488
+ /// ),
489
+ /// );
490
+ /// ```
471
491
pub fn with_conversion < S : ToString , I : Iterator < Item = TypeSpaceImpl > > (
472
492
& mut self ,
473
493
schema : schemars:: schema:: SchemaObject ,
You can’t perform that action at this time.
0 commit comments