mirror of
https://gitlab.com/msrd0/gotham-restful.git
synced 2025-05-09 16:10:42 +00:00
add server data for openapi
This commit is contained in:
parent
4ceb1ef302
commit
6cf4b05447
3 changed files with 15 additions and 9 deletions
|
@ -34,11 +34,12 @@ struct PathExtractor<ID : RefUnwindSafe + Send + 'static>
|
|||
#[cfg(feature = "openapi")]
|
||||
pub trait WithOpenapi<D>
|
||||
{
|
||||
fn with_openapi<F, Title, Version>(&mut self, title : Title, version : Version, block : F)
|
||||
fn with_openapi<F, Title, Version, Url>(&mut self, title : Title, version : Version, server_url : Url, block : F)
|
||||
where
|
||||
F : FnOnce((&mut D, &mut OpenapiRouter)),
|
||||
Title : ToString,
|
||||
Version : ToString;
|
||||
Version : ToString,
|
||||
Url : ToString;
|
||||
}
|
||||
|
||||
/// This trait adds the `resource` method to gotham's routing. It allows you to register
|
||||
|
@ -235,13 +236,14 @@ macro_rules! implDrawResourceRoutes {
|
|||
C : PipelineHandleChain<P> + Copy + Send + Sync + 'static,
|
||||
P : RefUnwindSafe + Send + Sync + 'static
|
||||
{
|
||||
fn with_openapi<F, Title, Version>(&mut self, title : Title, version : Version, block : F)
|
||||
fn with_openapi<F, Title, Version, Url>(&mut self, title : Title, version : Version, server_url : Url, block : F)
|
||||
where
|
||||
F : FnOnce((&mut Self, &mut OpenapiRouter)),
|
||||
Title : ToString,
|
||||
Version : ToString
|
||||
Version : ToString,
|
||||
Url : ToString
|
||||
{
|
||||
let mut router = OpenapiRouter::new(title, version);
|
||||
let mut router = OpenapiRouter::new(title, version, server_url);
|
||||
block((self, &mut router));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue