feat: Added support for flatten

This commit is contained in:
2025-09-15 21:32:57 +02:00
parent 2b970e87ae
commit 6d5c2da030
2 changed files with 40 additions and 5 deletions

24
tests/flatten.rs Normal file
View 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
");
}