feat: Added support for flatten
This commit is contained in:
24
tests/flatten.rs
Normal file
24
tests/flatten.rs
Normal file
@@ -0,0 +1,24 @@
|
||||
use lua_typed::Typed;
|
||||
|
||||
#[derive(Typed)]
|
||||
pub struct B {
|
||||
pub hello: String,
|
||||
pub world: bool,
|
||||
}
|
||||
|
||||
#[derive(Typed)]
|
||||
pub struct A {
|
||||
#[serde(flatten)]
|
||||
pub b: B,
|
||||
pub cool: u32,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn flatten() {
|
||||
insta::assert_snapshot!(<A as Typed>::generate_full().unwrap(), @r"
|
||||
---@class A
|
||||
---@field hello string
|
||||
---@field world boolean
|
||||
---@field cool integer
|
||||
");
|
||||
}
|
||||
Reference in New Issue
Block a user