BackendGeneratorPlugin

Trait BackendGeneratorPlugin 

Source
pub trait BackendGeneratorPlugin: Send + Sync {
    // Required methods
    fn backend_type(&self) -> &str;
    fn backend_name(&self) -> &str;
    fn supported_spec_versions(&self) -> Vec<&str>;
    fn supported_extensions(&self) -> Vec<&str>;
    fn generate_backend<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        spec: &'life1 OpenApiSpec,
        config: &'life2 BackendGeneratorConfig,
    ) -> Pin<Box<dyn Future<Output = Result<BackendGenerationResult, PluginError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn get_metadata<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = PluginMetadata> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn supports_database(&self, db_type: &str) -> bool;
    fn default_port(&self) -> u16;

    // Provided method
    fn validate_config<'life0, 'life1, 'async_trait>(
        &'life0 self,
        config: &'life1 BackendGeneratorConfig,
    ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait { ... }
}
Expand description

Backend generator plugin trait for generating framework-specific backend servers

Required Methods§

Source

fn backend_type(&self) -> &str

Get the backend type/framework name this plugin supports

Source

fn backend_name(&self) -> &str

Get a human-readable name for this backend

Source

fn supported_spec_versions(&self) -> Vec<&str>

Get the supported OpenAPI spec versions

Source

fn supported_extensions(&self) -> Vec<&str>

Get the supported file extensions for generated code

Source

fn generate_backend<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, spec: &'life1 OpenApiSpec, config: &'life2 BackendGeneratorConfig, ) -> Pin<Box<dyn Future<Output = Result<BackendGenerationResult, PluginError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Generate backend server code from OpenAPI specification

Source

fn get_metadata<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = PluginMetadata> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get plugin metadata

Source

fn supports_database(&self, db_type: &str) -> bool

Check if this generator supports the given database type

Source

fn default_port(&self) -> u16

Get default port for this backend type

Provided Methods§

Source

fn validate_config<'life0, 'life1, 'async_trait>( &'life0 self, config: &'life1 BackendGeneratorConfig, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Validate the plugin configuration

Implementors§