pub struct MockGenerator { /* private fields */ }Expand description
Mock generator for creating mocks from natural language
Implementations§
Source§impl MockGenerator
impl MockGenerator
Sourcepub fn new() -> MockGenerator
pub fn new() -> MockGenerator
Create a new mock generator with default configuration
Sourcepub fn with_config(config: IntelligentBehaviorConfig) -> MockGenerator
pub fn with_config(config: IntelligentBehaviorConfig) -> MockGenerator
Create a new mock generator with custom configuration
Sourcepub async fn generate(
&self,
description: &str,
_workspace_id: Option<&str>,
ai_mode: Option<AiMode>,
deterministic_config: Option<&DeterministicModeConfig>,
) -> Result<MockGenerationResult, Error>
pub async fn generate( &self, description: &str, _workspace_id: Option<&str>, ai_mode: Option<AiMode>, deterministic_config: Option<&DeterministicModeConfig>, ) -> Result<MockGenerationResult, Error>
Generate a mock from natural language description
This method parses the natural language description and generates a complete OpenAPI specification ready for use with MockForge.
§Example
ⓘ
use mockforge_core::ai_studio::nl_mock_generator::MockGenerator;
async fn example() -> mockforge_core::Result<()> {
let generator = MockGenerator::new();
let result = generator.generate(
"Create a user API with CRUD operations for managing users",
None,
None,
None,
).await?;
Ok(())
}Sourcepub async fn generate_with_context(
&self,
description: &str,
existing_spec: Option<&OpenApiSpec>,
) -> Result<MockGenerationResult, Error>
pub async fn generate_with_context( &self, description: &str, existing_spec: Option<&OpenApiSpec>, ) -> Result<MockGenerationResult, Error>
Generate a mock with additional context (for conversational mode)
This method allows generating mocks that extend or modify existing specifications.
Trait Implementations§
Source§impl Default for MockGenerator
impl Default for MockGenerator
Source§fn default() -> MockGenerator
fn default() -> MockGenerator
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MockGenerator
impl !RefUnwindSafe for MockGenerator
impl Send for MockGenerator
impl Sync for MockGenerator
impl Unpin for MockGenerator
impl UnsafeUnpin for MockGenerator
impl !UnwindSafe for MockGenerator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more