gesha_core/conversions/
converter.rs

1use crate::conversions::{Output, Result};
2use openapi_types::yaml::ToOpenApi;
3use std::fmt::{Debug, Display};
4use std::path::Path;
5
6/// Convert OpenAPI definitions to target type.
7pub trait Converter: Debug + Clone + Sized + Send + Sync + 'static {
8    /// The OpenAPI type that this definition converts from.
9    type OpenApiType: ToOpenApi + Debug + Send + Sync;
10
11    /// The target type that this definition converts to.
12    type TargetType: Display + Debug + Send + Sync;
13
14    /// Convert the given OpenAPI type to the target type.
15    fn convert(&self, src: Self::OpenApiType) -> Result<Output<Self::TargetType>>;
16
17    /// Format the code in the given path.
18    fn format_code(&self, path: &Path) -> Result<String>;
19}