Open that-ambuj opened 2 months ago
You can use the from
keyword to imports from another crate
#[utoipauto(paths = "./utoipauto/src from utoipauto")]
But I've only used it to import models from another crate that was still in the same workspace.
I think you could technically make it work by finding the downloaded path of the external crate and import from here but it don't think it's a good idea. There's definitely a big room for improvement in this field. but I don't really see how we could do it from a crate level...
If it's a big dependency that is very important to your project, I'd suggest that you inline it like you said.
I recently thought about how to solve this.
I would agree that scanning the actual source code is not a good idea. I can tackle the implementation but I would love if somebody could help me find an actual good concept for it.
Maybe there is a crate that "implements" reflections (but at compile-time)? Maybe even a crate that already supports scanning dependencies?
But I already thought about some requirements:
Hi, I have forked a rust project which has a lot of huge types, so I've added utoipa::ToSchema on all the types but now I need register them recursively, which is a lot of work.
I've seen that this library takes path to the module. Is there any way I can specify the module of an external crate like
some_lib::api
and it would work on that?The only hack I can think of is to put the git repo as submodule and a cargo workspace member and then specify the path. I hope there is a better solution or one that can be implemented.