fix: refactor syntax to correctly include structs (#1580)
This PR fixes a compilation bug related to conditionally adding docs behind a feature flag
This commit is contained in:
parent
df23062574
commit
c9f4c1af31
|
@ -1037,7 +1037,12 @@ pub async fn run(
|
||||||
};
|
};
|
||||||
|
|
||||||
// Define VertextApiDoc conditionally only if the "google" feature is enabled
|
// Define VertextApiDoc conditionally only if the "google" feature is enabled
|
||||||
|
let doc = {
|
||||||
|
// avoid `mut` if possible
|
||||||
#[cfg(feature = "google")]
|
#[cfg(feature = "google")]
|
||||||
|
{
|
||||||
|
use crate::VertexInstance;
|
||||||
|
|
||||||
#[derive(OpenApi)]
|
#[derive(OpenApi)]
|
||||||
#[openapi(
|
#[openapi(
|
||||||
paths(vertex_compatibility),
|
paths(vertex_compatibility),
|
||||||
|
@ -1045,12 +1050,8 @@ pub async fn run(
|
||||||
)]
|
)]
|
||||||
struct VertextApiDoc;
|
struct VertextApiDoc;
|
||||||
|
|
||||||
let doc = {
|
|
||||||
// avoid `mut` if possible
|
|
||||||
#[cfg(feature = "google")]
|
|
||||||
{
|
|
||||||
// limiting mutability to the smallest scope necessary
|
// limiting mutability to the smallest scope necessary
|
||||||
let mut doc = doc;
|
let mut doc = ApiDoc::openapi();
|
||||||
doc.merge(VertextApiDoc::openapi());
|
doc.merge(VertextApiDoc::openapi());
|
||||||
doc
|
doc
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue