You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've seen the flatten attribute in a bunch of places, but I don't think it's possible to add it to arguments yet. It would be useful to compose some structures better while keeping the API simple.
Let me know if it's already a thing and I missed it.
Code example (if possible)
#[derive(InputObject)]structMyData{a:String,b:String,}implMyData{fncompute_hash(&self) -> String{letSelf{ a, b } = self;format!("{a}-{b}")}}#[Object]implQueryRoot{asyncfntest_1(&self,_ctx:&Context<'_>,#[graphql(flatten)]data:MyData) -> String{
data.compute_hash()}asyncfntest_2(&self,_ctx:&Context<'_>,a:String,b:String) -> String{let data = MyData{ a, b };
data.compute_hash()}}
Basically, I would like test_1 and test_2 to have the same calling interface, especially in cases where I've only got a single argument.
In simple cases like this, it's simple enough to just construct MyData inside the function, but for more complicated cases, it gets very verbose, and it also gets weird when you may have some copyable variables both inside MyData and also as a plain function argument floating around.
The text was updated successfully, but these errors were encountered:
Description of the feature
I've seen the flatten attribute in a bunch of places, but I don't think it's possible to add it to arguments yet. It would be useful to compose some structures better while keeping the API simple.
Let me know if it's already a thing and I missed it.
Code example (if possible)
Basically, I would like
test_1
andtest_2
to have the same calling interface, especially in cases where I've only got a single argument.In simple cases like this, it's simple enough to just construct
MyData
inside the function, but for more complicated cases, it gets very verbose, and it also gets weird when you may have some copyable variables both insideMyData
and also as a plain function argument floating around.The text was updated successfully, but these errors were encountered: