drasi_bootstrap_application/
descriptor.rs1use drasi_lib::bootstrap::BootstrapProvider;
18use drasi_plugin_sdk::prelude::*;
19use utoipa::OpenApi;
20
21use crate::ApplicationBootstrapProvider;
22
23#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, utoipa::ToSchema)]
27#[schema(as = bootstrap::application::ApplicationBootstrapConfig)]
28pub struct ApplicationBootstrapConfigDto {}
29
30#[derive(OpenApi)]
33#[openapi(components(schemas(ApplicationBootstrapConfigDto)))]
34struct ApplicationBootstrapSchemas;
35
36pub struct ApplicationBootstrapDescriptor;
38
39#[async_trait]
40impl BootstrapPluginDescriptor for ApplicationBootstrapDescriptor {
41 fn kind(&self) -> &str {
42 "application"
43 }
44
45 fn config_version(&self) -> &str {
46 "1.0.0"
47 }
48
49 fn config_schema_name(&self) -> &str {
50 "bootstrap.application.ApplicationBootstrapConfig"
51 }
52
53 fn config_schema_json(&self) -> String {
54 let api = ApplicationBootstrapSchemas::openapi();
55 serde_json::to_string(
56 &api.components
57 .as_ref()
58 .expect("OpenAPI components missing")
59 .schemas,
60 )
61 .expect("Failed to serialize config schema")
62 }
63
64 async fn create_bootstrap_provider(
65 &self,
66 _config_json: &serde_json::Value,
67 _source_config_json: &serde_json::Value,
68 ) -> anyhow::Result<Box<dyn BootstrapProvider>> {
69 Ok(Box::new(ApplicationBootstrapProvider::new()))
70 }
71}