pub struct Generator { /* private fields */ }Expand description
OpenAPI generator.
Implementations§
Source§impl Generator
impl Generator
Sourcepub fn httpmock(
&mut self,
spec: &OpenAPI,
crate_path: &str,
) -> Result<TokenStream>
pub fn httpmock( &mut self, spec: &OpenAPI, crate_path: &str, ) -> Result<TokenStream>
Generate a strongly-typed mocking extension to the httpmock crate.
The crate_path parameter should be a valid Rust path corresponding to
the SDK. This can include :: and instances of - in the crate name
should be converted to _.
Source§impl Generator
impl Generator
Sourcepub fn extract_responses<'a>(
&self,
method: &'a OperationMethod,
filter: fn(&OperationResponseStatus) -> bool,
) -> (Vec<&'a OperationResponse>, ErrorResponseType)
pub fn extract_responses<'a>( &self, method: &'a OperationMethod, filter: fn(&OperationResponseStatus) -> bool, ) -> (Vec<&'a OperationResponse>, ErrorResponseType)
Extract responses that match criteria specified by the filter. The
result is a Vec<OperationResponse> that enumerates the cases matching
the filter, and an ErrorResponseType that represents the generated type(s)
for those cases.
Sourcepub fn generate_error_enum(
&self,
enum_name: &str,
variants: &[ErrorVariant],
) -> TokenStream
pub fn generate_error_enum( &self, enum_name: &str, variants: &[ErrorVariant], ) -> TokenStream
Generates an error enum type for operations with multiple error response types.
Source§impl Generator
impl Generator
Sourcepub fn new(settings: &GenerationSettings) -> Self
pub fn new(settings: &GenerationSettings) -> Self
Create a new generator with default values.
Sourcepub fn generate_tokens(&mut self, spec: &OpenAPI) -> Result<TokenStream>
pub fn generate_tokens(&mut self, spec: &OpenAPI) -> Result<TokenStream>
Emit a TokenStream containing the generated client code.
Sourcepub fn get_type_space(&self) -> &TypeSpace
pub fn get_type_space(&self) -> &TypeSpace
Get the TypeSpace for schemas present in the OpenAPI specification.
Sourcepub fn uses_futures(&self) -> bool
pub fn uses_futures(&self) -> bool
Whether the generated client needs to use additional crates to support futures.
Sourcepub fn uses_websockets(&self) -> bool
pub fn uses_websockets(&self) -> bool
Whether the generated client needs to use additional crates to support websockets.