Unverified Commit c9f4c1af authored by drbh's avatar drbh Committed by GitHub
Browse files

fix: refactor syntax to correctly include structs (#1580)

This PR fixes a compilation bug related to conditionally adding docs
behind a feature flag
parent df230625
...@@ -1037,20 +1037,21 @@ pub async fn run( ...@@ -1037,20 +1037,21 @@ pub async fn run(
}; };
// Define VertextApiDoc conditionally only if the "google" feature is enabled // Define VertextApiDoc conditionally only if the "google" feature is enabled
#[cfg(feature = "google")]
#[derive(OpenApi)]
#[openapi(
paths(vertex_compatibility),
components(schemas(VertexInstance, VertexRequest, VertexResponse))
)]
struct VertextApiDoc;
let doc = { let doc = {
// avoid `mut` if possible // avoid `mut` if possible
#[cfg(feature = "google")] #[cfg(feature = "google")]
{ {
use crate::VertexInstance;
#[derive(OpenApi)]
#[openapi(
paths(vertex_compatibility),
components(schemas(VertexInstance, VertexRequest, VertexResponse))
)]
struct VertextApiDoc;
// 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
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment