File tree Expand file tree Collapse file tree 1 file changed +17
-10
lines changed
Expand file tree Collapse file tree 1 file changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -38,19 +38,10 @@ const CRC_16_XMODEM: Crc<u16> = Crc::<u16>::new(&crc::CRC_16_XMODEM);
3838/// _ _:MsgAddressExt = MsgAddress;
3939/// ```
4040#[ cfg_attr( feature = "arbitrary" , derive( arbitrary:: Arbitrary ) ) ]
41- #[ cfg_attr(
42- all( feature = "schemars_0_8" , not( feature = "schemars_1" ) ) ,
43- derive( :: schemars_0_8:: JsonSchema ) ,
44- schemars( crate = "::schemars_0_8" )
45- ) ]
4641#[ cfg_attr(
4742 feature = "schemars_1" ,
4843 derive( :: schemars_1:: JsonSchema ) ,
49- schemars( crate = "::schemars_1" )
50- ) ]
51- #[ cfg_attr(
52- any( feature = "schemars_0_8" , feature = "schemars_1" ) ,
53- schemars( with = "String" )
44+ schemars( crate = "::schemars_1" , with = "String" )
5445) ]
5546#[ cfg_attr(
5647 feature = "serde" ,
@@ -414,6 +405,22 @@ impl<'de> BitUnpack<'de> for Anycast {
414405 }
415406}
416407
408+ #[ cfg( feature = "schemars_0_8" ) ]
409+ // schemars 0.8 supports #[schemars(with = "...")] attribute only for fields
410+ const _: ( ) = {
411+ use schemars_0_8:: { JsonSchema , r#gen:: SchemaGenerator , schema:: Schema } ;
412+
413+ impl JsonSchema for MsgAddress {
414+ fn schema_name ( ) -> String {
415+ String :: schema_name ( )
416+ }
417+
418+ fn json_schema ( generator : & mut SchemaGenerator ) -> Schema {
419+ String :: json_schema ( generator)
420+ }
421+ }
422+ } ;
423+
417424#[ cfg( test) ]
418425mod tests {
419426 use super :: * ;
You can’t perform that action at this time.
0 commit comments