pub struct MockGenerator { /* private fields */ }Expand description
Mock generator for creating mocks from natural language
Implementations§
Source§impl MockGenerator
impl MockGenerator
Sourcepub fn with_config(config: IntelligentBehaviorConfig) -> Self
pub fn with_config(config: IntelligentBehaviorConfig) -> Self
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>
pub async fn generate( &self, description: &str, _workspace_id: Option<&str>, ai_mode: Option<AiMode>, deterministic_config: Option<&DeterministicModeConfig>, ) -> Result<MockGenerationResult>
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>
pub async fn generate_with_context( &self, description: &str, existing_spec: Option<&OpenApiSpec>, ) -> Result<MockGenerationResult>
Generate a mock with additional context (for conversational mode)
This method allows generating mocks that extend or modify existing specifications.
Trait Implementations§
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