Closed k1ngcyk closed 6 months ago
Would like to see generics supported too. Otherwise, amazing crate!
I need this feature! I tried to add #[utoipa_ignore] and add the schema manually but that didn't worked.
I am goind to try to solve this. But give me a few days as this is my first time dealing with macros (let alone generic macros)
That would be a nice feature. However, #[utoipa_ignore] works for me, even with generics. Have you tried restarting rust analyzer? Can you give me a minimal reproducible example ? @DenuxPlays
That would be a nice feature.
However, #[utoipa_ignore] works for me, even with generics. Have you tried restarting rust analyzer? Can you give me a minimal reproducible example ? @DenuxPlays
No it works just fine. It was actually my code that made it look like it was the macros.
Also I have a plan which (if it works) would made the implementation of this feature very easy but I have to work on it tomorrow.
For the aliases features, you don't actually have to worry about generics. You can have a look at the parse_from_attr function, that's where the fix will probably be.
You can see that it's where we look at struct's macros.
You'll need to search for the aliases macro, and return DiscoverType::Model()
or DiscoverType::Response()
with the names defined within the aliases macros, instead of the actual generic struct name.
You'll need to learn a bit about the syn crate, but otherwise it shouldn't be that hard, and you'll learn a lot !
Feel free to ask if you have any struggles or questions, I'll do my best to help. Have fun !
For the aliases features, you don't actually have to worry about generics.
You can have a look at the parse_from_attr function, that's where the fix will probably be.
You can see that it's where we look at struct's macros.
You'll need to search for the aliases macro, and return
DiscoverType::Model()
orDiscoverType::Response()
with the names defined within the aliases macros, instead of the actual generic struct name.You'll need to learn a bit about the syn crate, but otherwise it shouldn't be that hard, and you'll learn a lot !
Feel free to ask if you have any struggles or questions, I'll do my best to help.
Have fun !
That's what I thought but thank you for the information. I think I can do this and I'll open a pr soon
They arent any generic responses right?
I think we could have some, just like models
I think we could have some, just like models
But here is no aliases macro for Response
I think we could have some, just like models
I acutally have a question. This my current progress..
if meta.path().is_ident("aliases") {
println!("{:?}\n", meta);
}
I cannot figure out on how to acces the inside of the aliases macro. Can you help me with that?
I can't really help you without implementing it mysef... Take a look at the syn crate
I can't really help you without implementing it mysef... Take a look at the syn crate
Ah okay Gonna do this something has to work lol
Hey, support for generics got added in the new 0.1.10 release. Thanks @DenuxPlays
Hey, support for generics got added in the new 0.1.10 release.
Thanks @DenuxPlays
If there are any bugs reported you can assign me. I can maintain this feature if needed
In utoipa we can do like:
and generates two schema
FooA
andFooB
,and utoipauto has compile error with: