11use enum_iterator:: Sequence ;
22use parse_display_derive:: { Display , FromStr } ;
3- use schemars:: JsonSchema ;
3+ use schemars:: { schema :: SchemaObject , JsonSchema } ;
44use serde:: { Deserialize , Serialize } ;
55use uuid:: Uuid ;
66
@@ -966,10 +966,9 @@ mod tests {
966966}
967967
968968/// How a property of an object should be transformed.
969- #[ derive( Clone , Debug , PartialEq , Deserialize , JsonSchema , Serialize ) ]
969+ #[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
970970#[ cfg_attr( feature = "ts-rs" , derive( ts_rs:: TS ) ) ]
971971#[ cfg_attr( feature = "ts-rs" , ts( export_to = "ModelingCmd.ts" ) ) ]
972- #[ serde( rename = "TransformBy" ) ]
973972pub struct TransformBy < T > {
974973 /// The scale, or rotation, or translation.
975974 pub property : T ,
@@ -983,6 +982,24 @@ pub struct TransformBy<T> {
983982 pub is_local : bool ,
984983}
985984
985+ impl < T : JsonSchema > JsonSchema for TransformBy < T > {
986+ fn schema_name ( ) -> String {
987+ format ! ( "TransformByFor{}" , T :: schema_name( ) )
988+ }
989+
990+ fn schema_id ( ) -> std:: borrow:: Cow < ' static , str > {
991+ std:: borrow:: Cow :: Owned ( format ! ( "{}::TransformBy<{}>" , module_path!( ) , T :: schema_id( ) ) )
992+ }
993+
994+ fn json_schema ( _: & mut schemars:: gen:: SchemaGenerator ) -> schemars:: schema:: Schema {
995+ SchemaObject {
996+ instance_type : Some ( schemars:: schema:: InstanceType :: String . into ( ) ) ,
997+ ..Default :: default ( )
998+ }
999+ . into ( )
1000+ }
1001+ }
1002+
9861003/// Container that holds a translate, rotate and scale.
9871004#[ derive( Clone , Debug , PartialEq , Deserialize , JsonSchema , Serialize ) ]
9881005#[ cfg_attr( feature = "ts-rs" , derive( ts_rs:: TS ) ) ]
0 commit comments