Skip to main content

generate_response_with_trace

Function generate_response_with_trace 

Source
pub fn generate_response_with_trace(
    spec: &OpenApiSpec,
    operation: &Operation,
    status_code: u16,
    content_type: Option<&str>,
    expand_tokens: bool,
    scenario: Option<&str>,
    selection_mode: Option<ResponseSelectionMode>,
    selector: Option<&ResponseSelector>,
    persona: Option<&Persona>,
) -> Result<(Value, ResponseGenerationTrace)>
Expand description

Generate a response with trace collection

This function wraps the response generation and collects trace data about how the response was generated.

§Arguments

  • spec - The OpenAPI specification
  • operation - The operation to generate a response for
  • status_code - The HTTP status code
  • content_type - Optional content type
  • expand_tokens - Whether to expand template tokens
  • scenario - Optional scenario name
  • selection_mode - Response selection mode
  • selector - Optional response selector
  • persona - Optional persona for data generation

§Returns

A tuple of (response_value, trace_data)