Skip to content

Commit c9f4c1a

Browse files
authored
fix: refactor syntax to correctly include structs (#1580)
This PR fixes a compilation bug related to conditionally adding docs behind a feature flag
1 parent df23062 commit c9f4c1a

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

router/src/server.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,20 +1037,21 @@ pub async fn run(
10371037
};
10381038

10391039
// Define VertextApiDoc conditionally only if the "google" feature is enabled
1040-
#[cfg(feature = "google")]
1041-
#[derive(OpenApi)]
1042-
#[openapi(
1043-
paths(vertex_compatibility),
1044-
components(schemas(VertexInstance, VertexRequest, VertexResponse))
1045-
)]
1046-
struct VertextApiDoc;
1047-
10481040
let doc = {
10491041
// avoid `mut` if possible
10501042
#[cfg(feature = "google")]
10511043
{
1044+
use crate::VertexInstance;
1045+
1046+
#[derive(OpenApi)]
1047+
#[openapi(
1048+
paths(vertex_compatibility),
1049+
components(schemas(VertexInstance, VertexRequest, VertexResponse))
1050+
)]
1051+
struct VertextApiDoc;
1052+
10521053
// limiting mutability to the smallest scope necessary
1053-
let mut doc = doc;
1054+
let mut doc = ApiDoc::openapi();
10541055
doc.merge(VertextApiDoc::openapi());
10551056
doc
10561057
}

0 commit comments

Comments
 (0)