roadster/api/cli/roadster/
open_api.rs

1use crate::api::cli::CliState;
2use crate::api::cli::roadster::RunRoadsterCommand;
3use crate::app::App;
4use crate::app::context::AppContext;
5use crate::error::RoadsterResult;
6use crate::service::http::service::{HttpService, OpenApiArgs};
7use async_trait::async_trait;
8use axum_core::extract::FromRef;
9
10#[async_trait]
11impl<A, S> RunRoadsterCommand<A, S> for OpenApiArgs
12where
13    S: Clone + Send + Sync + 'static,
14    AppContext: FromRef<S>,
15    A: App<S>,
16{
17    async fn run(&self, cli: &CliState<A, S>) -> RoadsterResult<bool> {
18        let http_service = cli.service_registry.get::<HttpService>()?;
19
20        http_service.print_open_api_schema(self)?;
21
22        Ok(true)
23    }
24}